-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (83 loc) · 3 KB
/
prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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 }}"