Skip to content

Commit

Permalink
feat: Release events now should continue pipeline via pr (#1615)
Browse files Browse the repository at this point in the history
  • Loading branch information
cberg-aot authored Sep 24, 2024
1 parent 5d58f53 commit 62d6e89
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
pr:
description: "PR num of image to deploy"
required: false
type: string

concurrency:
group: ${{ github.workflow }}
Expand All @@ -14,14 +19,23 @@ jobs:
vars:
name: Set Variables
outputs:
release-name: ${{ steps.release-name.outputs.release-name }}
pr: ${{ steps.pr.outputs.pr }}
runs-on: ubuntu-22.04
timeout-minutes: 1
steps:
# Get PR number for squash merges to main
- name: Get PR Number From Event
if: ${{ github.event_name == 'release' }}
id: pr_no
uses: bcgov-nr/[email protected]
- name: PR Number
id: pr
run: echo pr=${{ steps.pr_no.outputs.pr || inputs.pr}} >> $GITHUB_OUTPUT
- name: Release Name
id: release-name
run: |
echo release-name=$(curl https://api.github.com/repos/bcgov/onroutebc/releases/latest | jq -r .tag_name) >> $GITHUB_OUTPUT
promote-images-release:
name: Promote Images - Release
needs: [vars]
Expand All @@ -37,7 +51,7 @@ jobs:
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: test
target: ${{ needs.vars.outputs.pr }}
tags: ${{ needs.vars.outputs.release-name }}

deploys-uat:
Expand All @@ -46,7 +60,7 @@ jobs:
uses: ./.github/workflows/uat.yml
secrets: inherit
with:
tag: ${{ needs.vars.outputs.release-name }}
tag: ${{ needs.vars.outputs.pr }}

promote-images-uat:
name: Promote Images - Uat
Expand All @@ -63,7 +77,7 @@ jobs:
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ needs.vars.outputs.release-name }}
target: ${{ needs.vars.outputs.pr }}
tags: uat

deploys-prod:
Expand All @@ -72,7 +86,7 @@ jobs:
uses: ./.github/workflows/prod.yml
secrets: inherit
with:
tag: ${{ needs.vars.outputs.release-name }}
tag: ${{ needs.vars.outputs.pr }}

promote-images-prod:
name: Promote Images - Prod
Expand All @@ -89,5 +103,5 @@ jobs:
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: uat
target: ${{ needs.vars.outputs.pr }}
tags: prod

0 comments on commit 62d6e89

Please sign in to comment.