Skip to content

Update workflow to use google-github-actions/auth for authentication #6

Update workflow to use google-github-actions/auth for authentication

Update workflow to use google-github-actions/auth for authentication #6

Workflow file for this run

name: Deploy to GCS
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: "1.1.0"
- name: Initialize Terraform
id: init
run: terraform init
working-directory: ./terraform
- name: Apply Terraform
run: terraform apply -auto-approve
working-directory: ./terraform
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
version: 'latest'
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Deploy to GCS
run: |
gsutil -m rsync -r ./frontend gs://leaflet-site
- name: Configure GCS Bucket for Static Website
run: |
gsutil web set -m index.html -e index.html gs://leaflet-site