-
Notifications
You must be signed in to change notification settings - Fork 4
77 lines (61 loc) · 1.92 KB
/
main.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: wheretobin-cicd
on:
push:
branches: [main]
pull_request:
env:
REGION: asia-southeast1
GAR_LOCATION: asia-southeast1-docker.pkg.dev/personal-388003/demo-registry-gar
jobs:
# ==============
# CI task
# ==============
# build-and-push-image:
# environment: dev
# name: Build Docker image and push to repositories
# runs-on: ubuntu-latest
# strategy:
# matrix:
# module:
# [
# backend,
# frontend
# ]
# steps:
# - name: "Checkout"
# uses: "actions/checkout@v3"
# - name: Add image tags
# run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
# - id: "auth"
# uses: "google-github-actions/auth@v1"
# with:
# credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
# - name: "Set up Cloud SDK"
# uses: "google-github-actions/setup-gcloud@v1"
# - name: "Use gcloud CLI"
# run: "gcloud info"
# - name: "Docker auth"
# run: |-
# gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
# - name: Build image
# run: docker build -f Dockerfile -t ${{ env.GAR_LOCATION }}/${{ matrix.module }}:${{ env.SHORT_SHA }} .
# working-directory: ${{ matrix.module }}
# - name: Push image
# run: docker push ${{ env.GAR_LOCATION }}/${{ matrix.module }}:${{ env.SHORT_SHA }}
deploy:
environment: dev
name: Deploy with Terraform
runs-on: ubuntu-latest
container:
image: alpine/terragrunt
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Run Terragrunt"
working-directory: "terraform"
run: |-
cat ${SERVICE_ACCOUNT_KEY} > gcloud-sa-key.json
export GOOGLE_CREDENTIALS="./gcloud-sa-key.json"
export IMAGE_TAG=${{ env.SHORT_SHA }}
make plan ENV=dev
make apply ENV=dev