-
Notifications
You must be signed in to change notification settings - Fork 10
459 lines (436 loc) · 16.2 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
name: Release
on:
schedule:
- cron: "0 6 * * mon" # 6am UTC, 11pm PST
pull_request:
branches: '**'
workflow_dispatch:
inputs:
release_version:
type: string
description: "Release version (e.g. 0.1.0)"
required: true
create_release:
type: boolean
description: "Create release?"
required: true
default: false
prerelease:
type: boolean
description: "Prerelease?"
required: true
default: true
defaults:
run:
shell: bash
env:
CC: clang
RETENTION_DAYS: 7
jobs:
setup:
name: "Setup release & runtime versions"
runs-on: ubuntu-latest
outputs:
wasmtime_ver: ${{ steps.assign-versions.outputs.wasmtime_ver }}
wasmer_ver: ${{ steps.assign-versions.outputs.wasmer_ver }}
v8_ver: ${{ steps.assign-versions.outputs.v8_ver }}
create_release: ${{ steps.assign-vars.outputs.create_release }}
release_name: ${{ steps.assign-vars.outputs.release_name }}
release_channel: ${{ steps.assign-vars.outputs.release_channel }}
release_version: ${{ steps.assign-vars.outputs.release_version }}
steps:
- uses: actions/checkout@v3
- name: Assign runtime versions
id: assign-versions
run: |
export NGX_WASM_DIR=$(pwd)
. ./util/_lib.sh
echo "wasmtime_ver=$(get_variable_from_makefile WASMTIME)" >> $GITHUB_OUTPUT
echo "wasmer_ver=$(get_variable_from_makefile WASMER)" >> $GITHUB_OUTPUT
echo "v8_ver=$(get_variable_from_makefile V8)" >> $GITHUB_OUTPUT
- id: assign-vars
name: Assign release variables
run: |
if [ "${{ github.event_name }}" = schedule ]; then
# nightly
# wasmx-nightly-20231201
channel="nightly"
version="$(date -u +%Y%m%d)"
echo "create_release=true" >> $GITHUB_OUTPUT
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT
elif [ -n "${{ github.event.inputs.release_version }}" ]; then
# release/prerelease
version="${{ github.event.inputs.release_version }}"
echo "create_release=${{ github.event.inputs.create_release == 'true' }}" >> $GITHUB_OUTPUT
if [ "${{ github.event.inputs.prerelease }}" = "true" ]; then
# wasmx-prerelease-0.2.0
channel="prerelease"
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT
else
# wasmx-1.0.0
channel="release"
echo "release_name=$version" >> $GITHUB_OUTPUT
fi
else
# GHA test run
# wasmx-gha-run-1234
channel="gha-run"
version="${{ github.run_number }}"
echo "create_release=false" >> $GITHUB_OUTPUT
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT
fi
echo "release_channel=$channel" >> $GITHUB_OUTPUT
echo "release_version=$version" >> $GITHUB_OUTPUT
source-release:
name: "Source release"
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build archive
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --src
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
build-images:
name: "Build compilation images"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: "Ubuntu 18.04 build image"
file: "./assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04"
tags: "ghcr.io/kong/wasmx-build-ubuntu:18.04"
- name: "Ubuntu 20.04 build image"
file: "./assets/release/Dockerfiles/Dockerfile.ubuntu-20.04"
tags: "ghcr.io/kong/wasmx-build-ubuntu:20.04"
- name: "Ubuntu 22.04 build image"
file: "./assets/release/Dockerfiles/Dockerfile.ubuntu-22.04"
tags: "ghcr.io/kong/wasmx-build-ubuntu:22.04"
platforms: "linux/arm64,linux/amd64"
- name: "Centos 7 build image"
file: "./assets/release/Dockerfiles/Dockerfile.amd64.centos7"
tags: "ghcr.io/kong/wasmx-build-centos:7"
- name: "Centos 8 build image"
file: "./assets/release/Dockerfiles/Dockerfile.amd64.centos8"
tags: "ghcr.io/kong/wasmx-build-centos:8"
- name: "ArchLinux build image"
file: "./assets/release/Dockerfiles/Dockerfile.amd64.archlinux"
tags: "ghcr.io/kong/wasmx-build-arch:latest"
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: ${{ matrix.name }}
uses: docker/build-push-action@v4
with:
file: ${{ matrix.file }}
tags: ${{ matrix.tags }}
platforms: ${{ matrix.platforms }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
binary-ubuntu-bionic:
name: "Build Ubuntu 18.04 (bionic) binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-ubuntu:18.04
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-ubuntu-focal:
name: "Build Ubuntu 20.04 (focal) binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-ubuntu:20.04
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-ubuntu-jammy:
name: "Build Ubuntu 22.04 (jammy) binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-ubuntu:22.04
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-ubuntu-jammy-arm:
name: "Build ARM Ubuntu 22.04 (jammy) binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
- run: |
docker run \
--platform=linux/arm64 \
--volume $PWD:/wasmx \
--volume $GITHUB_ENV:$GITHUB_ENV \
-e CI \
-e GITHUB_ENV \
--env CARGO_NET_GIT_FETCH_WITH_CLI=true \
--env WASMTIME_VER='${{ needs.setup.outputs.wasmtime_ver }}' \
--env WASMER_VER='${{ needs.setup.outputs.wasmer_ver }}' \
--env V8_VER='${{ needs.setup.outputs.v8_ver }}' \
ghcr.io/kong/wasmx-build-ubuntu:22.04 \
/wasmx/util/release.sh ${{ needs.setup.outputs.release_name }} --bin
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-centos7:
name: "Build Centos 7 binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-centos:7
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-centos8:
name: "Build Centos 8 binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-centos:8
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-arch:
name: "Build ArchLinux binary"
needs: [setup, build-images]
runs-on: ubuntu-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
container:
image: ghcr.io/kong/wasmx-build-arch:latest
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.TOKEN_GITHUB }}
steps:
- uses: actions/checkout@v3
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
binary-macos:
name: "Build macOS binary"
needs: [setup, build-images]
runs-on: macos-latest
env:
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }}
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }}
V8_VER: ${{ needs.setup.outputs.v8_ver }}
steps:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
brew install ninja openssh
pip3 install --upgrade setuptools
- name: Build binary
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: dist
retention-days: ${{ env.RETENTION_DAYS }}
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}
path: work/dist/build/*
upload-artifacts:
name: "Upload release artifacts"
needs: [setup, source-release, binary-ubuntu-bionic, binary-ubuntu-focal, binary-ubuntu-jammy, binary-ubuntu-jammy-arm, binary-centos7, binary-centos8, binary-arch, binary-macos]
runs-on: ubuntu-latest
steps:
- name: Retrieve sibling release artifacts
uses: actions/download-artifact@v3
with:
name: release-artifacts
- name: Drop Wasmer binaries
run: find . -name '*wasmer*' | xargs rm -f
# Channel: nightly
- name: Nightly release
uses: marvinpinto/action-automatic-releases@latest
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'nightly' }}
with:
prerelease: true
title: ${{ needs.setup.outputs.release_name }}
automatic_release_tag: nightly
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.tar.gz
# Channel: prerelease
- name: Prerelease
uses: marvinpinto/action-automatic-releases@latest
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'prerelease' }}
with:
draft: true
prerelease: true
title: Prerelease - ${{ needs.setup.outputs.release_version }}
automatic_release_tag: ${{ needs.setup.outputs.release_name }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.tar.gz
# Channel: release
- name: Release
uses: marvinpinto/action-automatic-releases@latest
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'release' }}
with:
draft: true
prerelease: false
title: Release - ${{ needs.setup.outputs.release_version }}
automatic_release_tag: ${{ needs.setup.outputs.release_name }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: |
*.tar.gz