-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (38 loc) · 1.21 KB
/
deploy.yml
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
name: Deploy to Google Cloud Run
on:
push:
branches:
- main
- redeploy-action
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: htan-dcc
- name: Log in to Google Artifact Registry
run: gcloud auth configure-docker us-docker.pkg.dev
- name: Build and push Docker image
run: |
cd src
docker build . -t us-docker.pkg.dev/htan-dcc/gcr.io/data-release-validation:${{ github.sha }}
docker push us-docker.pkg.dev/htan-dcc/gcr.io/data-release-validation:${{ github.sha }}
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.7.0
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan -var="image_tag=${{ github.sha }}"
- name: Terraform Apply
run: terraform apply -var="image_tag=${{ github.sha }}" -auto-approve