feat: workflow improvements #208
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
concurrency: | |
# Cancel in progress for PR open and close | |
group: ${{ github.event.number }} | |
cancel-in-progress: false | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: write # This is required for actions/checkout | |
packages: write | |
pull-requests: write | |
env: | |
AWS_REGION: ca-central-1 | |
jobs: | |
# https://github.com/bcgov-nr/action-builder-ghcr | |
builds: | |
name: Builds | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
package: [backend, migrations, frontend] | |
timeout-minutes: 10 | |
steps: | |
- uses: bcgov-nr/[email protected] | |
with: | |
keep_versions: 50 | |
package: ${{ matrix.package }} | |
tag: ${{ github.event.number }} | |
tag_fallback: latest | |
triggers: ('${{ matrix.package }}/') | |
plan-stack: | |
name: Plan Stack | |
uses: ./.github/workflows/.deploy_stack.yml | |
with: | |
environment_name: dev | |
command: plan | |
tag: ${{ github.event.number }} | |
app_env: ephermal-${{ github.event.number }} # ephermal, prefixed for easy clean up of PR resources in s3 and dynamodb generated by terraform | |
secrets: inherit | |
tests: | |
name: Tests | |
needs: builds | |
uses: ./.github/workflows/.tests.yml | |
with: | |
tag: ${{ github.event.number }} | |
results: | |
name: PR Results | |
needs: [builds, plan-stack, tests] | |
if: always() | |
runs-on: ubuntu-24.04 | |
steps: | |
- if: contains(needs.*.result, 'failure')||contains(needs.*.result, 'canceled') | |
run: echo "At least one job has failed." && exit 1 | |
- run: echo "Success!" |