Skip to content

chore(deps): update dependency firebase-tools to v13.25.0 (#1562) #935

chore(deps): update dependency firebase-tools to v13.25.0 (#1562)

chore(deps): update dependency firebase-tools to v13.25.0 (#1562) #935

name: 'Deploy (staging)'
on:
push:
branches:
- main
permissions:
contents: 'read'
id-token: 'write'
jobs:
install-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: yarn
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
- uses: ./.github/actions/setup-go
deploy-api:
environment: staging
runs-on: ubuntu-latest
needs: [install-deps]
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ vars.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GOOGLE_DEPLOY_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- uses: ./.github/actions/setup-go
- uses: imjasonh/[email protected]
env:
KO_DOCKER_REPO: us-central1-docker.pkg.dev/${{ steps.auth.outputs.project_id }}/cloud-run-builds
- name: Build Docker image of api
id: 'build-api'
run: echo "::set-output name=image::$(ko build ./apps/api)"
- name: Deploy to Cloud Run (api)
run: |
gcloud --quiet beta run deploy ${{ vars.CLOUD_RUN_SERVICE_NAME_API }} \
--image ${{ steps.build-api.outputs.image }} \
--labels environment=staging \
--service-account ${{ vars.CLOUD_RUN_SERVICE_ACCOUNT }} \
--execution-environment gen1 --region us-central1 --platform managed --memory 128Mi --allow-unauthenticated \
--set-env-vars GITHUB_AUTH_TOKEN="${{ secrets.GH_AUTH_TOKEN }}" \
--set-env-vars CACHE_STORAGE_BUCKET="${{ vars.APP_CACHE_BUCKET }}" \
--set-env-vars APP_ENV="staging"
deploy-worker:
environment: staging
runs-on: ubuntu-latest
needs: [install-deps]
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ vars.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GOOGLE_DEPLOY_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- uses: ./.github/actions/setup-go
- uses: imjasonh/[email protected]
env:
KO_DOCKER_REPO: us-central1-docker.pkg.dev/${{ steps.auth.outputs.project_id }}/cloud-run-builds
- name: Build Docker image of worker
id: 'build-worker'
run: echo "::set-output name=image::$(ko build ./apps/worker)"
- name: Deploy to Cloud Run (worker)
run: |
gcloud --quiet beta run deploy ${{ vars.CLOUD_RUN_SERVICE_NAME_WORKER }} \
--image ${{ steps.build-worker.outputs.image }} \
--labels environment=staging \
--service-account ${{ vars.CLOUD_RUN_SERVICE_ACCOUNT }} \
--execution-environment gen1 --region us-central1 --platform managed --memory 128Mi \
--set-env-vars APP_ENV="staging"
deploy-webapp:
environment: staging
runs-on: ubuntu-latest
needs: [deploy-api]
steps:
- uses: actions/checkout@v4
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ vars.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GOOGLE_DEPLOY_SERVICE_ACCOUNT }}
- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: yarn
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn build:all:staging
- name: Deploy webapp to Firebase
run: yarn firebase deploy --project=${{ steps.auth.outputs.project_id }} --only=hosting:staging