feat: CE-1002 Allow CEEB users to capture authorization number (#84) #48
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: Merge | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "*.md" | |
- ".github/**" | |
- ".graphics/**" | |
- "!.github/workflows/**" | |
workflow_dispatch: | |
inputs: | |
pr_no: | |
description: "PR-numbered container set to deploy" | |
type: number | |
required: true | |
jobs: | |
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 | |
deploy-test: | |
name: Deploy (test) | |
needs: [vars] | |
environment: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout CD repo | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-dc0a4a | |
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }} | |
ref: main | |
- name: Configure git | |
# From https://github.com/orgs/community/discussions/26560#discussioncomment-3531273 | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Update image tag And Enable it for deployment | |
run: | | |
cd charts/nr-compliance-enforcement-cm | |
yq eval '.global.tag="${{ needs.vars.outputs.pr }}"' -i values.yaml | |
yq eval '.global.tag="${{ needs.vars.outputs.pr }}"' -i values-static.yaml | |
- name: Commit and push update | |
shell: bash | |
run: | | |
git commit -am "Update image tag for pull request deployment and enable it for values.yaml for TEST deployment" | |
git push origin main | |
deploy-prod: | |
name: Deploy (prod) | |
needs: [deploy-test, vars] | |
environment: prod | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout CD repo | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-dc0a4a | |
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }} | |
ref: main | |
- name: Configure git | |
# From https://github.com/orgs/community/discussions/26560#discussioncomment-3531273 | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Update image tag And Enable it for deployment | |
run: | | |
cd charts/nr-compliance-enforcement-cm | |
yq eval '.global.tag="${{ needs.vars.outputs.pr }}"' -i values-prod.yaml | |
- name: Commit and push update | |
shell: bash | |
run: | | |
git commit -am "Update image tag for pull request deployment and enable it for values-prod.yaml for PROD deployment" | |
git push origin main | |
promote: | |
name: Promote Images | |
needs: [deploy-prod, vars] | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
package: [migrations, backend] | |
timeout-minutes: 1 | |
steps: | |
- uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: ${{ needs.vars.outputs.pr }} | |
tags: prod |