1+ name : hmr-build-deploy
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - ' master'
7+
8+ defaults :
9+ run :
10+ working-directory : .
11+
12+ jobs :
13+ cancel-previous-runs :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ actions : write
17+ steps :
18+ - name : Cancel Previous Runs
19+ uses : styfle/cancel-workflow-action@0.9.1
20+ with :
21+ access_token : ${{ github.token }}
22+
23+ build :
24+ runs-on : ubuntu-latest
25+ defaults :
26+ run :
27+ working-directory : ./.pipeline
28+ steps :
29+ - uses : actions/checkout@v2
30+ - uses : actions/setup-node@v2
31+ with :
32+ node-version : " 12"
33+ - name : Build
34+ run : |
35+ oc version
36+ oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }}
37+ npm ci
38+ DEBUG=* npm run build -- --pr=${{ github.event.pull_request.number }} --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}
39+
40+ deploy-to-dev :
41+ runs-on : ubuntu-latest
42+ needs : [build]
43+ defaults :
44+ run :
45+ working-directory : ./.pipeline
46+ steps :
47+ - uses : actions/checkout@v2
48+ - uses : actions/setup-node@v2
49+ with :
50+ node-version : " 12"
51+ - name : Deploy the image
52+ run : |
53+ oc version
54+ oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }}
55+ npm ci
56+ DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=dev --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}
57+
58+ deploy-to-test :
59+ needs : [build, deploy-to-dev]
60+ environment :
61+ name : test
62+ runs-on : ubuntu-latest
63+ defaults :
64+ run :
65+ working-directory : ./.pipeline
66+ steps :
67+ - uses : actions/checkout@v2
68+ - uses : actions/setup-node@v2
69+ with :
70+ node-version : " 12"
71+ - name : Deploy the image
72+ run : |
73+ oc version
74+ oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }}
75+ npm ci
76+ DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=test --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}
77+
78+ deploy-to-uat :
79+ needs : [build, deploy-to-test]
80+ environment :
81+ name : uat
82+ runs-on : ubuntu-latest
83+ defaults :
84+ run :
85+ working-directory : ./.pipeline
86+ steps :
87+
88+ - uses : actions/checkout@v2
89+ - uses : actions/setup-node@v2
90+ with :
91+ node-version : " 12"
92+ - name : Deploy the image
93+ run : |
94+ oc version
95+ oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }}
96+ npm ci
97+ DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=uat --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}
98+
99+ deploy-to-prod :
100+ needs : [build, deploy-to-uat]
101+ environment :
102+ name : prod
103+ runs-on : ubuntu-latest
104+ defaults :
105+ run :
106+ working-directory : ./.pipeline
107+ steps :
108+ - uses : actions/checkout@v2
109+ - uses : actions/setup-node@v2
110+ with :
111+ node-version : " 12"
112+ - name : Deploy the image
113+ run : |
114+ oc version
115+ oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }}
116+ npm ci
117+ DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=prod --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}
0 commit comments