-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (50 loc) · 1.91 KB
/
deploy.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
name: deploy
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
API_IMAGE_NAME: alcs-api
MIGRATE_IMAGE_NAME: alcs-migrate
FE_IMAGE_NAME: alcs-frontend
PORTAL_API_IMAGE_NAME: alcs-portal-api
GITOPS_REPO: bcgov-c/tenant-gitops-a5cf88
jobs:
deploy:
environment: ${{ inputs.environment }}
runs-on: ubuntu-22.04
steps:
- name: Lowercase repo owner
id: lowercase_repo_owner
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository_owner }}
- name: Authenticate to OpenShift
run: |
DOCKER_IMAGE=ghcr.io/${{ steps.lowercase_repo_owner.outputs.lowercase }}/alcs-api
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }}
- name: Import Images
run: |
import() { \
echo "Importing $1" ; \
oc import-image $1:${{ github.sha }} --from ghcr.io/bcgov/$1:${{ github.sha }} -n ${{secrets.LICENSE_PLATE}}-tools ;}
import alcs-api
import alcs-frontend
import alcs-migrate
import alcs-portal-frontend
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITOPS_PAT }}
repository: ${{ env.GITOPS_REPO }}
event-type: deploy-${{ inputs.environment }}
client-payload: |
{
"alcs-api": "image-registry.apps.silver.devops.gov.bc.ca/a5cf88-tools/alcs-api:${{ github.sha }}",
"alcs-frontend": "image-registry.apps.silver.devops.gov.bc.ca/a5cf88-tools/alcs-frontend:${{ github.sha }}",
"alcs-migrate": "image-registry.apps.silver.devops.gov.bc.ca/a5cf88-tools/alcs-migrate:${{ github.sha }}",
"alcs-portal-frontend": "image-registry.apps.silver.devops.gov.bc.ca/a5cf88-tools/alcs-portal-frontend:${{ github.sha }}",
"commitMessage": "${{ github.sha }}"
}