-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (48 loc) · 1.72 KB
/
deploy.yml
File metadata and controls
62 lines (48 loc) · 1.72 KB
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
55
56
57
58
59
60
61
62
name: Build and Deploy to Google Cloud Run ☁️⚙️🚀
on:
push:
branches:
- main
paths:
- 'backend/src/**'
- 'frontend/src/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout 🕵'
id: 'checkout'
uses: actions/checkout@v2
- name: 'auth 🔑'
id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: 'Set up Cloud SDK ☁️'
uses: 'google-github-actions/setup-gcloud@v0'
- name: 'Set sha 🧮'
id: sha
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: 'Build Docker image and upload to GCCR ⚙️'
run: 'PROJECT_ID=${{ secrets.PROJECT_ID }} SERVICE=${{ secrets.SERVICE }} SHA=${{ steps.sha.outputs.sha_short }} ./build.sh'
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: hashicorp/setup-terraform@v1
- name: checkout 🕵'
id: 'checkout'
uses: actions/checkout@v2
- name: 'auth 🔑'
id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: 'Set up Cloud SDK ☁️'
uses: 'google-github-actions/setup-gcloud@v0'
- name: 'Setup terraform 🟪'
run: 'terraform init'
- name: 'Initialize terraform env vars ☂️'
run: 'CONNECTION_STRING="${{ secrets.CONNECTION_STRING }}" GITHUB_CLIENT_ID="${{ secrets.OAUTH_GITHUB_CLIENT_ID }}" GITHUB_CLIENT_SECRET="${{ secrets.OAUTH_GITHUB_CLIENT_SECRET }}" ./createTerraformVarsFile.sh CONNECTION_STRING GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET'
- name: 'Terraform Apply 🚀'
run: 'terraform apply -lock=false -auto-approve'