-
Notifications
You must be signed in to change notification settings - Fork 13
296 lines (247 loc) · 8.38 KB
/
release.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: Create release ...
on:
push:
tags:
- '*'
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use nodejs
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Build production
run: npm run build:prod
- name: Build development
run: npm run build:dev
- name: ESlint
run: npm run eslint
- name: Units test
run: npm run cover
- name: Build package # FIXME inutile ou commit ?
run: npm pack
- name: Create Zip # FIXME inutile ?
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
run: |
zip --junk-paths bundles dist/*
- name: Upload JSDoc artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: jsdoc
path: jsdoc
- name: Upload Binary artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
- name: Upload Bundles artifacts # FIXME inutile ?
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: bundles
path: bundles.zip
- name: Upload Reporter Coverage artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage/lcov-report
- name: Upload Reporter Test artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: test-report
path: test-report
publish_gh-pages:
# if: false
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
repository: IGNF/geoportal-access-lib
ref: gh-pages
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo v${GITHUB_REF##*/})
- name: Initialize
run: |
mkdir -p tmp/jsdoc
mkdir -p tmp/dist
mkdir -p tmp/coverage
mkdir -p tmp/test-report
mkdir ${{ steps.get_version.outputs.VERSION }}
- name: Download JSDoc artifacts
uses: actions/download-artifact@v2
with:
name: jsdoc
path: tmp/jsdoc
- name: Build jsdoc
run: |
cp -r tmp/jsdoc current
cp -r tmp/jsdoc ${{ steps.get_version.outputs.VERSION }}
- name: Download bundles artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: tmp/dist
- name: Build bundles
run: |
cp -r tmp/dist current
cp -r tmp/dist ${{ steps.get_version.outputs.VERSION }}
- name: Link versions
run: |
rm latest
ln -s ${{ steps.get_version.outputs.VERSION }} latest
- name: Download coverage artifacts
uses: actions/download-artifact@v2
with:
name: coverage
path: tmp/coverage
- name: Build coverage
run: |
rm -rf current/coverage
cp -r tmp/coverage current
- name: Download test-report artifacts
uses: actions/download-artifact@v2
with:
name: test-report
path: tmp/test-report
- name: Build test-report
run: |
rm -rf current/test-report
cp -r tmp/test-report current
- name: Clean and publish
run: |
rm -rf tmp/
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "update jsdoc and bundles to release ${{ steps.get_version.outputs.VERSION }}"
git push
create_release:
# if: false
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: DRAFT_CHANGELOG.md
draft: false
prerelease: false
- name: Download bundles artifacts # FIXME inutile ?
uses: actions/download-artifact@v2
with:
name: bundles
- name: Download bundles artifacts
uses: actions/download-artifact@v2
with:
name: dist
- name: Upload Release Asset (bundles) # FIXME inutile ?
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN}}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bundles.zip
asset_name: bundles.zip
asset_content_type: application/zip
- name: Upload Release Asset (1)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./GpServices.js
asset_name: GpServices.js
asset_content_type: application/javascript
- name: Upload Release Asset (2)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./GpServices-src.js
asset_name: GpServices-src.js
asset_content_type: application/javascript
- name: Upload Release Asset (3)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./GpServices-map.js
asset_name: GpServices-map.js
asset_content_type: application/javascript
publish_package:
# if: false
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Initialize
run: |
mkdir dist
- name: Download bundles artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Use registry npm
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
# scope: '@ignf-geoportal'
- name: Publish on npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GEOPORTAL_TOKEN }}
publish_samples:
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: publish_package
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v2
with:
repository: IGNF/geoportal-access-lib-samples
ref: master
token : ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo ${GITHUB_REF##*/})
- name: Update package.json
run: |
sed -i -e "s/\"geoportal-access-lib\": \".*\"/\"geoportal-access-lib\": \"${{ steps.get_version.outputs.VERSION }}\"/" package.json
- name: Publish
run: |
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "update geoportal-access-lib release v${{ steps.get_version.outputs.VERSION }}"
git push