-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (117 loc) · 3.2 KB
/
test-and-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
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
name: Test and Deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
repository_dispatch:
types: [data-models-update, data-model-validator-update, rpde-validator-update]
jobs:
test-models:
runs-on: ubuntu-latest
steps:
- name: Checkout validator
uses: actions/checkout@v2
with:
repository: openactive/data-models
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install
run: npm install
- name: Test
run: npm test
test-data-model-validator:
runs-on: ubuntu-latest
steps:
- name: Checkout validator
uses: actions/checkout@v2
with:
repository: openactive/data-model-validator
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install
run: npm install
- name: Test
run: npm test
test-rpde-validator:
runs-on: ubuntu-latest
steps:
- name: Checkout validator
uses: actions/checkout@v2
with:
repository: openactive/rpde-validator
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install
run: npm install
- name: Test
run: npm test
test-site:
runs-on: ubuntu-latest
steps:
- name: Checkout validator site
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install
run: npm install
- name: Test
run: npm test
- name: Start server (in background)
run: npm run start &
- name: Lost Pixel
uses: lost-pixel/lost-pixel@v3.16.0
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}
deploy-site:
needs: [test-site, test-models, test-data-model-validator, test-rpde-validator]
if: ${{ github.ref == 'refs/heads/master' }}
concurrency:
group: data-model-validator-staging
cancel-in-progress: true
environment:
# Matches the name of the Heroku app
name: data-model-validator-staging
url: https://validator-staging.openactive.io/
runs-on: ubuntu-latest
steps:
- name: Checkout validator app
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Heroku authentication
uses: extractions/netrc@v2
with:
machine: git.heroku.com
password: ${{ secrets.HEROKU_API_KEY }}
- name: Deploy validator app to Heroku
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
heroku git:remote --app data-model-validator-staging
git push heroku master -f
promote-site:
needs: deploy-site
if: ${{ github.ref == 'refs/heads/master' }}
concurrency:
group: validator.openactive.io
cancel-in-progress: true
environment:
name: validator.openactive.io
url: https://validator.openactive.io/
runs-on: ubuntu-latest
steps:
- name: Promote validator app to production
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
heroku pipelines:promote --app data-model-validator-staging