From 61ede2270b168b6aac66107502176ee2003b48ec Mon Sep 17 00:00:00 2001 From: cberg-aot <93226309+cberg-aot@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:01:18 -0700 Subject: [PATCH] fix: deploying via last merged pr instead of tag promotion (#1621) --- .github/workflows/release.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1665ec400..a2e83b8bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,19 @@ jobs: vars: name: Set Variables outputs: + pr: ${{ steps.pr.outputs.pr }} release-name: ${{ steps.release-name.outputs.release-name }} 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 == 'push' }} + id: pr_no + uses: bcgov-nr/action-get-pr@main + - name: PR Number + id: pr + run: echo pr=${{ steps.pr_no.outputs.pr || inputs.pr}} >> $GITHUB_OUTPUT - name: Release Name id: release-name run: | @@ -38,7 +47,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: @@ -47,7 +56,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 @@ -64,7 +73,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: @@ -73,7 +82,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 @@ -90,5 +99,5 @@ jobs: with: registry: ghcr.io repository: ${{ github.repository }}/${{ matrix.package }} - target: ${{ needs.vars.outputs.release-name }} + target: ${{ needs.vars.outputs.pr }} tags: prod