Skip to content

Instantly share code, notes, and snippets.

@wenqiglantz
Created February 19, 2023 19:48
Show Gist options
  • Save wenqiglantz/7f9b4c553abc8d876f7f8be3ea49bee8 to your computer and use it in GitHub Desktop.
Save wenqiglantz/7f9b4c553abc8d876f7f8be3ea49bee8 to your computer and use it in GitHub Desktop.
name: Build and deploy to multiple environments
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run the workflow against'
type: environment
required: true
permissions:
contents: read
jobs:
build-and-test:
name: Build and test
permissions:
id-token: write # need this for OIDC
contents: read
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/ci-stateful.yml@main
with:
env: dev
secrets: inherit
deploy-to-dev:
name: Deploy to Dev
needs: [build-and-test]
permissions:
id-token: write # need this for OIDC
contents: read
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/cd-stateful.yml@main
with:
env: dev
image-tag: ${{ needs.build-and-test.outputs.image-tag }}
secrets: inherit
deploy-to-qc:
name: Deploy to QC
needs: [build-and-test, deploy-to-dev]
permissions:
id-token: write # need this for OIDC
contents: read
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/cd-stateful.yml@main
with:
env: qc
image-tag: ${{ needs.build-and-test.outputs.image-tag }}
secrets: inherit
deploy-to-staging:
name: Deploy to Staging
needs: [build-and-test, deploy-to-qc]
permissions:
id-token: write # need this for OIDC
contents: read
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/cd-stateful.yml@main
with:
env: staging
image-tag: ${{ needs.build-and-test.outputs.image-tag }}
secrets: inherit
deploy-to-prod:
name: Deploy to Prod
needs: [build-and-test, deploy-to-staging]
permissions:
id-token: write # need this for OIDC
contents: read
uses: wenqiglantz/reusable-workflows-modules/.github/workflows/cd-stateful.yml@main
with:
env: prod
image-tag: ${{ needs.build-and-test.outputs.image-tag }}
secrets: inherit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment