-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (135 loc) · 4.68 KB
/
merge.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Merge
on:
push:
branches: [main]
paths-ignore:
- "**.md"
workflow_dispatch:
env:
DOMAIN: apps.silver.devops.gov.bc.ca
NS: nr-d2723f
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
deploy-test:
name: TEST Deployment
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.changelog.outputs.tag }}
permissions:
contents: write
discussions: write
environment:
name: test
steps:
- uses: actions/checkout@v4
- name: Deploys
uses: bcgov-nr/action-deployer-openshift@v3.0.0
with:
file: openshift.deploy.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
verification_path: /health
parameters:
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
-p ORACLEDB_SECRET=${{ secrets.ORACLEDB_SECRET }}
-p ZONE=test
- name: Publish API
uses: bcgov-nr/action-gwa-publish@v0.1.0
with:
namespace: ${{ env.NS }}
client_id: ${{ secrets.GWA_ACCT_ID }}
client_secret: ${{ secrets.GWA_ACCT_SECRET }}
file: .github/gwa/service-test.yaml
- name: Postman Smoke Test on API Gateway
uses: matt-ball/newman-action@master
with:
collection: postman/FCA.postman_collection.json
envVar: '[{"key":"URL_FCA","value":"https://${{ github.event.repository.name }}-test.api.gov.bc.ca"}]'
reporters: '["cli"]'
folder: '["general"]'
- name: Conventional Changelog Update
uses: TriPSs/conventional-changelog-action@v5
id: changelog
continue-on-error: true
with:
github-token: ${{ github.token }}
output-file: "CHANGELOG.md"
skip-version-file: "true"
skip-commit: "true"
git-push: "true"
- name: Create Release
uses: softprops/action-gh-release@v2
if: ${{ steps.changelog.outputs.tag != '' }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
token: ${{ github.token }}
tag_name: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
image-promotions:
name: Image Promotions
needs: [deploy-test]
runs-on: ubuntu-22.04
strategy:
matrix:
tag: [prod, "${{ needs.deploy-test.outputs.tag }}"]
steps:
- name: Promoting API
if: ${{ matrix.tag != '' }}
uses: shrink/actions-docker-registry-tag@v4
with:
registry: ghcr.io
repository: ${{ github.repository }}/api
target: test
tags: ${{ matrix.tag }}
- name: Promoting API
if: ${{ matrix.tag == '' }}
run: echo "Tag is empty, promotion step skipped"
deploy-prod:
name: PROD Deployment
needs: [image-promotions]
runs-on: ubuntu-22.04
environment:
name: prod
steps:
- uses: actions/checkout@v4
- name: Deploys
uses: bcgov-nr/action-deployer-openshift@v3.0.0
with:
file: openshift.deploy.yml
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
verification_path: /health
parameters:
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
-p ORACLEDB_SECRET=${{ secrets.ORACLEDB_SECRET }}
-p ZONE=prod
- name: Publish API
uses: bcgov-nr/action-gwa-publish@v0.1.0
with:
namespace: ${{ env.NS }}
client_id: ${{ secrets.GWA_ACCT_ID }}
client_secret: ${{ secrets.GWA_ACCT_SECRET }}
file: .github/gwa/service-prod.yaml
- name: Postman Smoke Test on API Gateway
uses: matt-ball/newman-action@master
with:
collection: postman/FCA.postman_collection.json
envVar: '[{"key":"URL_FCA","value":"https://${{ github.event.repository.name }}-prod.api.gov.bc.ca"}]'
reporters: '["cli"]'
folder: '["general"]'