-
Notifications
You must be signed in to change notification settings - Fork 14
320 lines (269 loc) · 9.56 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
name: Create 2D/3D Release ...
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # ex. 3.12.5
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: Install Libs Perl
run: |
sudo apt-get install perl-base libjson-perl
- name: Build 2D
run: |
npm run build:2d
- name: Build 3D
run: |
npm run build:3d
# FIXME doit on commiter le package ?
- name: Create Packages 2D/3D
run: |
cd ./scripts/release/
chmod 755 build-pack.sh
./build-pack.sh -a
- name: Create Zip 2D
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
run: |
zip --junk-paths bundles-2d dist/2d/*
- name: Create Zip 3D
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
run: |
zip --junk-paths bundles-3d dist/3d/*
- 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 2D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: dist-2d
path: dist/2d
- name: Upload Binary 3D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: dist-3d
path: dist/3d
- name: Upload Bundles 2D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: bundles-2d
path: bundles-2d.zip
- name: Upload Bundles 3D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: bundles-3d
path: bundles-3d.zip
- name: Upload Package 2D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: package-2d
path: scripts/release/geoportal-sdk-2d
- name: Upload Package 3D artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: package-3d
path: scripts/release/geoportal-sdk-3d
publish_gh-pages:
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-sdk
ref: gh-pages
- name: Get the tagname
id: get_tagname
run: echo ::set-output name=TAGNAME::$(echo ${GITHUB_REF##*/})
- name: Initialize
run: |
mkdir -p tmp/jsdoc/
mkdir -p tmp/dist/2d/
mkdir -p tmp/dist/3d/
mkdir -p ${{ steps.get_tagname.outputs.TAGNAME }}/dist/
- 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_tagname.outputs.TAGNAME }}
- name: Download Binary 2D artifacts
uses: actions/download-artifact@v2
with:
name: dist-2d
path: tmp/dist/2d/
- name: Download Binary 2D artifacts
uses: actions/download-artifact@v2
with:
name: dist-3d
path: tmp/dist/3d/
- name: Build Binary
run: |
cp -r tmp/dist/ current/
cp -r tmp/dist/ ${{ steps.get_tagname.outputs.TAGNAME }}
- name: Link versions
run: |
rm latest
ln -s ${{ steps.get_tagname.outputs.TAGNAME }} latest
- 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 / bundles to release 2D/3D : ${{ steps.get_tagname.outputs.TAGNAME }}"
git push
create_release:
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: build
runs-on: ubuntu-latest
steps:
- name: Install Perl
run: |
sudo apt-get install perl-base
- name: Checkout # checkout repository to get DRAFT_CHANGELOG.md !
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo ${GITHUB_REF##*/})
- name: Get Package.json value
id: get_package_value
run: |
echo ::set-output name=DATE::$(cat package.json | perl -MJSON -0ne 'my $DS = decode_json $_; my $field = 'date'; print $DS->{$field};' | sed -e 's/\//\\\//g')
echo ::set-output name=VERSION::$(cat package.json | perl -MJSON -0ne 'my $DS = decode_json $_; my $field = 'version'; print $DS->{$field};')
- name: Create ChangeLog
run: | # cf. http://fahdshariff.blogspot.com/2012/12/sed-mutli-line-replacement-between-two.html
sed -i 's/__VERSION__/${{ steps.get_package_value.outputs.VERSION }}/g' DRAFT_CHANGELOG.md
sed -i 's/__DATE__/${{ steps.get_package_value.outputs.DATE }}/g' DRAFT_CHANGELOG.md
- name: Upload ChangeLog artifacts
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
uses: actions/upload-artifact@v2
with:
name: changelog
path: DRAFT_CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: DRAFT_CHANGELOG.md
draft: false
prerelease: false
- name: Download bundles 2D artifacts
uses: actions/download-artifact@v2
with:
name: bundles-2d
- name: Upload Release Asset 2D
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bundles-2d.zip
asset_name: GpSDK-2D-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Download bundles 3D artifacts
uses: actions/download-artifact@v2
with:
name: bundles-3d
- name: Upload Release Asset 3D
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bundles-3d.zip
asset_name: GpSDK-3D-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
publish_package:
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 -p package-2d
mkdir -p package-3d
- name: Use nodejs
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Use registry npm
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Download Package 2D artifacts
uses: actions/download-artifact@v2
with:
name: package-2d
path: package-2d
- name: Download Package 3D artifacts
uses: actions/download-artifact@v2
with:
name: package-3d
path: package-3d
- name: Publish 2D on npm
run: |
cd ./package-2d
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GEOPORTAL_TOKEN }}
- name: Publish 3D on npm
run: |
cd ./package-3d
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GEOPORTAL_TOKEN }}
changelog:
if: github.event_name == 'push' && contains(github.ref, '/tags/') # Only for tags !
needs: [create_release, publish_package]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
repository: IGNF/geoportal-sdk
ref: develop
token: ${{ secrets.ADMIN_GEOPORTAL_TOKEN }}
- name: Download ChangeLog artifacts
uses: actions/download-artifact@v2
with:
name: changelog
- name: Reset draft changelog
run: |
rm DRAFT_CHANGELOG.md
cp .github/CHANGELOG_TEMPLATE.md DRAFT_CHANGELOG.md
- name: Clean and publish
run: |
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "reset DRAFT_CHANGELOG"
git push --force