-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (40 loc) · 1.28 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
50
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: Log in to Google Artifact Registry
env:
GCP_PROJECT: htan-dcc
run: |
echo ${{ secrets.GCP_SA_KEY }} | gcloud auth activate-service-account --key-file=-
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 Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
version: 'latest'
project_id: htan-dcc
service_account_key: ${{ secrets.GCP_SA_KEY }}
- 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