Skip to content

Update deploy.yml

Update deploy.yml #1

Workflow file for this run

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