diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index a2e1d2e..9a2d617 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -9,12 +9,25 @@ on: workflow_dispatch: concurrency: - group: ${{ github.workflow }} + group: test-prod cancel-in-progress: false jobs: - deploys-test: + vars: + name: Set Variables + outputs: + pr: ${{ steps.pr.outputs.pr }} + runs-on: ubuntu-22.04 + timeout-minutes: 1 + steps: + # Get PR number for squash merges to main + - name: PR Number + id: pr + uses: bcgov-nr/action-get-pr@v0.0.1 + + deploys: name: TEST Deployments + needs: [vars] environment: test runs-on: ubuntu-22.04 strategy: @@ -34,5 +47,22 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} overwrite: true parameters: - -p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test - -p NAME=${{ github.event.repository.name }} \ No newline at end of file + -p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ needs.vars.outputs.pr }} + + promotions: + name: Promote Images + needs: [deploys, vars] + permissions: + packages: write + runs-on: ubuntu-22.04 + strategy: + matrix: + package: [frontend, rctool] + timeout-minutes: 1 + steps: + - uses: shrink/actions-docker-registry-tag@v4 + with: + registry: ghcr.io + repository: ${{ github.repository }}/${{ matrix.package }} + tags: test + target: ${{ needs.vars.outputs.pr }} diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index dbf015e..1cdf77a 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -30,7 +30,7 @@ jobs: build_file: ${{ matrix.build_file }} build_context: ./frontend tag: ${{ github.event.number }} - tag_fallback: test + tag_fallback: latest token: ${{ secrets.GITHUB_TOKEN }} triggers: ('frontend/') diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index ec6fb05..428e79d 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -5,8 +5,8 @@ on: types: [published] concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true + group: test-prod + cancel-in-progress: false jobs: deploys: @@ -30,9 +30,9 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} overwrite: true parameters: - -p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:latest + -p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test - image-promotions: + promotions: name: Promote Images needs: [deploys] permissions: @@ -48,4 +48,4 @@ jobs: registry: ghcr.io repository: ${{ github.repository }}/${{ matrix.package }} tags: prod - target: latest + target: test