How to Deploy a Dataflow Job With GitHub Actions
gcloud dataflow flex-template run launches a Dataflow pipeline from a built template, parameterized at runtime.
Authenticate via WIF, then run gcloud dataflow flex-template run pointing at the template spec in GCS, with --parameters for inputs and outputs.
Steps
- Authenticate via WIF and set up gcloud.
- Reference a flex-template spec in GCS.
- Run
flex-template runwith--parameters.
Workflow
.github/workflows/deploy.yml
permissions:
id-token: write
contents: read
jobs:
launch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.WIF_PROVIDER }}
service_account: ${{ vars.DEPLOY_SA }}
- uses: google-github-actions/setup-gcloud@v2
- run: |
gcloud dataflow flex-template run "etl-${{ github.run_id }}" \
--template-file-gcs-location gs://my-templates/etl.json \
--region us-central1 \
--parameters inputTable=ds.in,outputTable=ds.outGotchas
- The worker service account needs Dataflow Worker plus access to the source and sink.
- Job names must be unique; suffix with
github.run_idto avoid "job already exists".
Related guides
How to Deploy With Cloud Build From GitHub ActionsTrigger a Cloud Build pipeline from GitHub Actions with gcloud builds submit, running your cloudbuild.yaml to…
How to Deploy a Cloud Run Job With GitHub ActionsDeploy a Cloud Run Job (for batch and one-off tasks) from GitHub Actions with gcloud run jobs deploy, then ex…