Skip to content

update env vars

update env vars #132

name: 'Build and Push Flow Emulator Image'
on:
push:
branches:
- main
pull_request:
branches:
- main
# Manual trigger, with a flag to decide if we also push
workflow_dispatch:
inputs:
push:
description: 'Also push the image to the registry'
type: boolean
default: false
env:
DOCKER_IMAGE_URL: us-west1-docker.pkg.dev/dl-flow-devex-staging/backend/flow-emulator:${{ github.sha }}
jobs:
build:
name: Build Flow Emulator Image
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
outputs:
image-url: ${{ env.DOCKER_IMAGE_URL }}
steps:
- name: 'Checkout'
uses: 'actions/checkout@v4'
with:
submodules: recursive
token: ${{ secrets.GH_PAT }}
- name: 'Build Flow Emulator image'
run: |
docker build -t "${{ env.DOCKER_IMAGE_URL }}" .
push:
name: Push Flow Emulator Image
runs-on: ubuntu-latest
needs: build
# Only run when manually dispatched *and* push=true
if: ${{ github.event_name == 'workflow_dispatch' && inputs.push == true }}
permissions:
contents: read
id-token: write
steps:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ vars.BUILDER_WORKLOAD_IDENTITY_PROVIDER }}'
service_account: '${{ vars.BUILDER_SERVICE_ACCOUNT }}'
- name: 'Set up gcloud'
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: ${{ vars.GAR_PROJECT_ID }}
- name: 'Push Flow Emulator image'
run: |
gcloud auth configure-docker ${{ vars.GAR_REGION }}-docker.pkg.dev
docker push "${{ needs.build.outputs.image-url }}"