Skip to content

Merge

Merge #10

Workflow file for this run

name: Merge
on:
workflow_run:
workflows: [PR Closed]
types: [completed]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
deploys-test:
name: TEST Deploys
environment: test
runs-on: ubuntu-22.04
permissions:
issues: write
strategy:
matrix:
name: [backend, frontend]
include:
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
verification_path: /health
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
steps:
- uses: bcgov-nr/[email protected]
with:
file: ${{ matrix.file }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
parameters:
-p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test
-p NAME=${{ github.event.repository.name }} ${{ matrix.parameters }}
verification_path: ${{ matrix.verification_path }}
deploys-prod:
name: PROD Deploys
needs: [deploys-test]
environment: prod
runs-on: ubuntu-22.04
strategy:
matrix:
name: [backend, frontend]
include:
- name: backend
file: backend/openshift.deploy.yml
overwrite: true
verification_path: /health
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
steps:
- uses: bcgov-nr/[email protected]
with:
file: ${{ matrix.file }}
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
parameters:
-p ZONE=prod -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test
-p NAME=${{ github.event.repository.name }} ${{ matrix.parameters }}
verification_path: ${{ matrix.verification_path }}
image-promotions:
name: Promote images
needs: [deploys-prod]
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
component: [backend, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.component }}
target: test
tags: prod
ghcr-cleanup:
name: GHCR Cleanup
runs-on: ubuntu-latest
strategy:
matrix:
name: [backend, frontend]
steps:
- name: Keep last 50
uses: actions/delete-package-versions@v4
with:
package-name: "${{ github.event.repository.name }}/${{ matrix.name }}"
package-type: "container"
min-versions-to-keep: 50
ignore-versions: "^(prod|test)$"