-
Notifications
You must be signed in to change notification settings - Fork 7
150 lines (120 loc) · 4.49 KB
/
build-release.yaml
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
150
## For each release, the value of workflow name, branches, PR_NUMBER and RELEASE_NAME need to be adjusted accordingly
## Also change the .pipelin/lib/config.js version number
name: CTHUB v0.2.0
on:
push:
branches: [ release-0.2.0 ]
workflow_dispatch:
workflow_call:
env:
## The pull request number of the Tracking pull request to merge the release branch to main
PR_NUMBER: 73
RELEASE_NAME: release-0.2.0
jobs:
## This is the CI job
build:
name: Build CTHUB on Openshift
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
## it will checkout to /home/runner/work/cthub/cthub
- name: Check out repository
uses: actions/checkout@v3
# open it when cthub updated the python packages
#- name: Run django tests
# uses: kuanfandevops/django-test-action@cthub-django-test
# with:
# settings-dir-path: "backend/cthub"
# requirements-file: "backend/requirements.txt"
# managepy-dir: backend
## Log in to Openshift with a token of service account
- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools
## Run build on Openshift
- name: Run build
run: |
cd .pipeline
npm install
npm run build -- --pr=${{ env.PR_NUMBER }} --env=build
deploy-on-dev:
name: Deploy CTHUB on Dev Environment
runs-on: ubuntu-latest
timeout-minutes: 60
needs: build
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev
- name: Run BCDK deployment on CTHUB Dev environment
run: |
cd .pipeline
echo "Deploying CTHUB ${{ env.RELEASE_NAME }} on Dev"
npm install
npm run deploy -- --pr=${{ env.PR_NUMBER }} --env=dev
deploy-on-test:
name: Deploy CTHUB on Test Environment
runs-on: ubuntu-latest
timeout-minutes: 60
needs: deploy-on-dev
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-test
- name: Ask for approval for CTHUB Test deployment
uses: trstringer/[email protected]
with:
secret: ${{ github.TOKEN }}
approvers: emi-hi,tim738745,kuanfandevops,JulianForeman
minimum-approvals: 1
issue-title: "CTHUB ${{ env.RELEASE_NAME }} Test Deployment"
- name: Run BCDK deployment on CTHUB Test environment
run: |
cd .pipeline
echo "Deploying CTHUB ${{ env.RELEASE_NAME }} on Test"
npm install
npm run deploy -- --pr=${{ env.PR_NUMBER }} --env=test
deploy-on-prod:
name: Deploy CTHUB on Prod Environment
runs-on: ubuntu-latest
timeout-minutes: 60
needs: deploy-on-test
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Log in to Openshift
uses: redhat-actions/[email protected]
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-prod
- name: Ask for approval for CTHUB Prod deployment
uses: trstringer/[email protected]
with:
secret: ${{ github.TOKEN }}
approvers: emi-hi,tim738745,kuanfandevops,JulianForeman
minimum-approvals: 2
issue-title: "CTHUB ${{ env.RELEASE_NAME }} Prod Deployment"
- name: Run BCDK deployment on CTHUB Prod environment
run: |
cd .pipeline
echo "Deploying CTHUB ${{ env.RELEASE_NAME }} on Prod"
npm install
npm run deploy -- --pr=${{ env.PR_NUMBER }} --env=prod