v1.32.6 #37
Workflow file for this run
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: 4. Promote from UAT to Prod | |
on: | |
workflow_dispatch: #Make sure you select a tag and not a branch if using manually | |
release: | |
types: [published] | |
env: | |
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
REGISTRY_USER: ${{ github.actor }} | |
REGISTRY_PASSWORD: ${{ github.token }} | |
permissions: | |
packages: write | |
jobs: | |
deploy-pre: | |
runs-on: ubuntu-latest | |
name: Create Tag Variable (remove V) | |
timeout-minutes: 1 | |
outputs: | |
tag: ${{ steps.vars.outputs.tag }} | |
steps: | |
- name: Remove v from version for the docker tag | |
id: vars | |
run: | | |
vtag=${{ github.ref_name }} | |
echo "tag=${vtag//v}" >> $GITHUB_OUTPUT | |
#This job adds 'latest-prod' docker tags to the existing image so it's always clear which image is current for a particular environment | |
addDockerTag: | |
needs: [deploy-pre] | |
runs-on: ubuntu-latest | |
name: Add latest-prod Tag | |
steps: | |
- name: Add latest-prod tag to django image | |
uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: bcgov/drivebc-django | |
target: ${{ needs.deploy-pre.outputs.tag }} | |
tags: | | |
latest-prod | |
- name: Add latest-prod tag to static image | |
uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: bcgov/drivebc-static | |
target: ${{ needs.deploy-pre.outputs.tag }} | |
tags: | | |
latest-prod | |
- name: Add latest-uat tag to redis image | |
uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: bcgov/drivebc-redis | |
target: ${{ needs.deploy-pre.outputs.tag }} | |
tags: | | |
latest-prod | |
- name: Add latest-uat tag to openshiftjobs image | |
uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: bcgov/drivebc-openshiftjobs | |
target: ${{ needs.deploy-pre.outputs.tag }} | |
tags: | | |
latest-prod | |
deploy: | |
needs: [deploy-pre] | |
runs-on: ubuntu-latest | |
name: Promote Images to OpenShift | |
environment: | |
name: prod | |
url: https://beta.drivebc.ca/ | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
namespace: ${{ env.OPENSHIFT_NAMESPACE }} | |
insecure_skip_tls_verify: true | |
- name: Helm upgrade on OpenShift Environment | |
run: | | |
helm dependency update ./infrastructure/main | |
helm upgrade prod-drivebc -f ./infrastructure/main/values-prod.yaml ./infrastructure/main --set django.image.tag="${{ needs.deploy-pre.outputs.tag }}" --set redis.image.tag="${{ needs.deploy-pre.outputs.tag }}" --set static.image.tag="${{ needs.deploy-pre.outputs.tag }}" --set tasks.image.tag="${{ needs.deploy-pre.outputs.tag }}" --set openshiftjobs.image.tag="${{ needs.deploy-pre.outputs.tag }}" |