forked from sidpalas/storybooks
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.21 KB
/
build-push-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Build and Deploy to Google Compute Engine
on:
push:
branches:
- master
tags:
- v\d+.\d+.\d+
env:
PROJECT_ID: devops-directive-traversy
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Set ENV
run: |-
if [ ${GITHUB_REF##*/} = "master" ]; then
echo "::set-env name=ENV::staging"
else
echo "::set-env name=ENV::prod"
fi
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCE_SA_KEY }}
project_id: ${{ env.PROJECT_ID }}
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Build the Docker image
- name: Build
run: |-
make build
# Push the Docker image to Google Container Registry
- name: Publish
run: |-
make push
- name: Deploy
run: |-
make deploy