-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (198 loc) · 7.03 KB
/
workflow.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Continuous Integration and Delivery
on: [push, pull_request]
env:
NODE_VERSION: 20.13.1
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.cache/puppeteer
jobs:
install:
name: 'Installing NPM modules'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Running npm ci (if node_modules not cached)'
uses: actions/cache@v4
id: node-modules-cache
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: npm ci
lint:
name: 'Linting'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run lint
build-solace-message-client:
name: 'Building solace-message-client'
needs: install
runs-on: ubuntu-latest
outputs:
version: ${{ steps.solace-message-client-package-json.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Reading package.json version of solace-message-client'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/package-json@master
id: solace-message-client-package-json
with:
path: projects/solace-message-client/package.json
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: 'Building solace-message-client'
run: npm run solace-message-client:build
- name: 'Building API Documentation (TypeDoc)'
run: npm run solace-message-client:typedoc
- uses: actions/upload-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- uses: actions/upload-artifact@v3
with:
name: solace-message-client-api
path: dist/solace-message-client-api
build-tryme-app:
name: 'Building TryMe App'
needs: build-solace-message-client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: 'Downloading solace-message-client'
uses: actions/download-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- name: 'Building TryMe App'
run: npm run solace-message-client-testing-app:build
- uses: actions/upload-artifact@v3
with:
name: tryme-app
path: dist/solace-message-client-testing-app/browser
test:
name: 'Unit Testing'
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Restoring NPM modules from cache'
uses: actions/cache@v4
with:
path: ./node_modules
key: node_modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- run: npm run test:headless
release-guard:
name: 'Release Guard'
if: github.ref == 'refs/heads/master'
needs:
- build-solace-message-client
- build-tryme-app
- lint
- test
runs-on: ubuntu-latest
outputs:
should-release: ${{ steps.tag-release-commit.outputs.is-release-commit }}
steps:
- uses: actions/checkout@v4
- name: 'If release commit present, add release tag'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/tag-release-commit@master
id: tag-release-commit
with:
release-commit-message-pattern: 'release\(solace-message-client\): v(.*)'
expected-version: ${{ needs.build-solace-message-client.outputs.version }}
deploy-api:
name: 'Deploying API (TypeDoc) to GitHub Pages'
if: ${{ needs.release-guard.outputs.should-release == 'true' }}
needs: [ release-guard ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading API'
uses: actions/download-artifact@v3
with:
name: solace-message-client-api
path: dist/api
- name: 'Deploying API to GitHub Pages'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: 'release(api): publish API documentation'
folder: dist
clean: true
clean-exclude: |
tryme
deploy-tryme-app:
name: 'Deploying TryMe App to GitHub Pages'
if: github.ref == 'refs/heads/master'
needs:
- build-solace-message-client
- build-tryme-app
- lint
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading TryMe App'
uses: actions/download-artifact@v3
with:
name: tryme-app
path: dist/tryme
- name: 'Deploying TryMe App to GitHub Pages'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: 'release(tryme): publish TryMe application'
folder: dist
clean: true
clean-exclude: |
api
release:
name: 'Releasing @solace-community/angular-solace-message-client'
if: ${{ needs.release-guard.outputs.should-release == 'true' }}
needs: [ build-solace-message-client, release-guard ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Downloading dist/solace-message-client'
uses: actions/download-artifact@v3
with:
name: solace-message-client
path: dist/@solace-community/angular-solace-message-client
- name: 'Publishing @solace-community/angular-solace-message-client to NPM'
uses: SchweizerischeBundesbahnen/scion-toolkit/.github/actions/npm-publish@master
with:
dist-folder: dist/@solace-community/angular-solace-message-client
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}
dry-run: false
- name: 'Creating GitHub Release'
run: gh release create $VERSION --title $VERSION --notes-file CHANGELOG_LATEST.md --verify-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build-solace-message-client.outputs.version }}