Skip to content

Capitalise development branch name #1

Capitalise development branch name

Capitalise development branch name #1

Workflow file for this run

name: Multi stage build & deploy
on:
pull_request:
push:
branches: ["main", "development"]
paths:
- "src/**"
- ".github/workflows/matrix-deploy.yml"
jobs:
set-env:
runs-on: ubuntu-latest
name: Set Environment (Matrix Deploy)
outputs:
branch: ${{ steps.var.outputs.branch }}
checked-out-sha: ${{ steps.var.outputs.checked-out-sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- id: var
run: |
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
CHECKED_OUT_SHA="$(git log -1 '--format=format:%H')"
echo "branch=$GIT_BRANCH" >> $GITHUB_OUTPUT
echo "checked-out-sha=${CHECKED_OUT_SHA}" >> $GITHUB_OUTPUT
create-and-publish-image:
needs: set-env
name: Create & Publish Image
uses: ./.github/workflows/build-image.yml
secrets: inherit
with:
branch: ${{ needs.set-env.outputs.branch }}
checked-out-sha: ${{ needs.set-env.outputs.checked-out-sha }}
create-and-tag-release:
needs: [set-env, create-and-publish-image]
name: Create & Tag Release
uses: ./.github/workflows/create-tag-release.yml
secrets: inherit
check-for-terraform-changes:
needs: create-and-publish-image
runs-on: ubuntu-latest
name: Check for Terraform File Changes
outputs:
run_terraform_deploy: ${{ steps.terraform_changes.outputs.run_terraform_deploy }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 2
- name: Check for Terraform File Changes
id: terraform_changes
run: |
LAST_COMMIT_SHA=${{ github.sha }}
PENULTIMATE_COMMIT_SHA=$(git rev-list -n 1 --skip 1 $LAST_COMMIT_SHA | tail -n 1)
echo "Last commit SHA: $LAST_COMMIT_SHA and Penultimate commit SHA: $PENULTIMATE_COMMIT_SHA"
changed_files="$(git diff --name-only $PENULTIMATE_COMMIT_SHA $LAST_COMMIT_SHA)"
echo "Changed files:"
echo "$changed_files"
if [[ "$changed_files" =~ terraform/container-app ]]; then
echo "Terraform files have changed. Running Terraform deploy..."
echo "run_terraform_deploy=true" >> $GITHUB_OUTPUT
else
echo "No Terraform file changes in terraform/container-app. Skipping Terraform deploy."
echo "run_terraform_deploy=false" >> $GITHUB_OUTPUT
fi
plan-terraform-for-dev-and-test:
needs: check-for-terraform-changes
name: Plan Terraform Infrastructure for Dev & Test
if: ${{ needs.check-for-terraform-changes.outputs.run_terraform_deploy == 'true' }}
strategy:
fail-fast: true
matrix:
target: [Dev, Tst]
uses: ./.github/workflows/terraform-plan.yml
with:
environment: ${{ matrix.target }}
secrets: inherit
deploy-to-dev-and-test:
needs: [set-env, create-and-publish-image, check-for-terraform-changes]
name: Deployment to Dev & Test
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Dev, Tst]
uses: ./.github/workflows/deploy-image.yml
with:
environment: ${{ matrix.target }}
branch: ${{ needs.set-env.outputs.branch }}
checked-out-sha: ${{ needs.set-env.outputs.checked-out-sha }}
secrets: inherit
generate-subtopic-visualisations:
needs: [set-env, deploy-to-dev-and-test]
name: Run the visualisation workflow again staging content.
if: ${{ needs.set-env.outputs.branch == 'main' }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Staging]
uses: ./.github/workflows/qa-viz.yml

Check failure on line 113 in .github/workflows/matrix-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/matrix-deploy.yml

Invalid workflow file

error parsing called workflow ".github/workflows/matrix-deploy.yml" -> "./.github/workflows/qa-viz.yml" : failed to fetch workflow: workflow was not found.
with:
environment: ${{ matrix.target }}
secrets: inherit
plan-terraform-for-staging:
needs: [set-env, deploy-to-dev-and-test, check-for-terraform-changes]
name: Plan Terraform Infrastructure for staging
if: ${{ needs.check-for-terraform-changes.outputs.run_terraform_deploy == 'true' && needs.set-env.outputs.branch == 'main' }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Staging]
uses: ./.github/workflows/terraform-plan.yml
with:
environment: ${{ matrix.target }}
secrets: inherit
deploy-to-staging:
needs: [set-env, create-and-publish-image, deploy-to-dev-and-test]
name: Deployment to Staging
if: ${{ needs.set-env.outputs.branch == 'main' }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Staging]
uses: ./.github/workflows/deploy-image.yml
with:
environment: ${{ matrix.target }}
branch: ${{ needs.set-env.outputs.branch }}
checked-out-sha: ${{ needs.set-env.outputs.checked-out-sha }}
secrets: inherit
plan-terraform-for-production:
needs:
[
set-env,
deploy-to-dev-and-test,
check-for-terraform-changes,
deploy-to-staging,
]
name: Plan Terraform Infrastructure for production
if: ${{ needs.check-for-terraform-changes.outputs.run_terraform_deploy == 'true' && needs.set-env.outputs.branch == 'main' }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Production]
uses: ./.github/workflows/terraform-plan.yml
with:
environment: ${{ matrix.target }}
secrets: inherit
deploy-to-production:
needs:
[
set-env,
create-and-publish-image,
deploy-to-dev-and-test,
deploy-to-staging,
]
name: Deployment to Production
if: ${{ needs.set-env.outputs.branch == 'main' }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
target: [Production]
uses: ./.github/workflows/deploy-image.yml
with:
environment: ${{ matrix.target }}
branch: ${{ needs.set-env.outputs.branch }}
checked-out-sha: ${{ needs.set-env.outputs.checked-out-sha }}
secrets: inherit