Skip to content

Merge branch 'feature' #4

Merge branch 'feature'

Merge branch 'feature' #4

Workflow file for this run

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/[email protected]
deploy-test:
name: Deploy (test)
needs: [vars]
runs-on: ubuntu-22.04
steps:
- name: Checkout CD repo
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-a7469b
ssh-key: ${{ secrets.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/quickstart-openshift-emerald
yq eval '.global.tag="${{ needs.vars.outputs.pr }}"' -i values.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]
runs-on: ubuntu-22.04
steps:
- name: Checkout CD repo
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-a7469b
ssh-key: ${{ secrets.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/quickstart-openshift-emerald
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, frontend]
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