Skip to content

Deploy

Deploy #56

Workflow file for this run

name: Deploy
permissions:
contents: read
id-token: write
on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to ("prod" or "test")'
type: environment
default: test
required: true
env:
BACKEND_IMAGE_REF: us-west1-docker.pkg.dev/${{ secrets.GCP_PROJECT_SLUG }}/firetower-docker/firetower:${{ github.sha }}
STATIC_IMAGE_REF: us-west1-docker.pkg.dev/${{ secrets.GCP_PROJECT_SLUG }}/firetower-docker/nginx:${{ github.sha }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: deploy-test-db-migration
if: ${{ inputs.environment == 'test' }}
uses: "google-github-actions/deploy-cloudrun@v3"
with:
job: firetower-test-db-migration
project_id: ${{ secrets.GCP_PROJECT_SLUG }}
region: us-west1
image: ${{ env.BACKEND_IMAGE_REF }}
wait: true
- name: deploy-test
if: ${{ inputs.environment == 'test' }}
uses: "google-github-actions/deploy-cloudrun@v3"
with:
service: firetower-test
project_id: ${{ secrets.GCP_PROJECT_SLUG }}
region: us-west1
# NOTE: we use flags here because the action does not natively support updating multiple containers.
flags: >
--container nginx --image "${{ env.STATIC_IMAGE_REF }}" --port 80
--container firetower-backend --image "${{ env.BACKEND_IMAGE_REF }}"
- name: deploy-prod-db-migration
if: ${{ (github.ref == 'refs/heads/main' && !inputs.environment ) || inputs.environment == 'prod' }}
uses: "google-github-actions/deploy-cloudrun@v3"
with:
job: firetower-prod-db-migration
project_id: ${{ secrets.GCP_PROJECT_SLUG }}
region: us-west1
image: ${{ env.BACKEND_IMAGE_REF }}
wait: true
- name: deploy-prod
if: ${{ (github.ref == 'refs/heads/main' && !inputs.environment ) || inputs.environment == 'prod' }}
uses: "google-github-actions/deploy-cloudrun@v3"
with:
service: firetower
project_id: ${{ secrets.GCP_PROJECT_SLUG }}
region: us-west1
# NOTE: we use flags here because the action does not natively support updating multiple containers.
flags: >
--container nginx --image "${{ env.STATIC_IMAGE_REF }}" --port 80
--container firetower-backend --image "${{ env.BACKEND_IMAGE_REF }}"