11name : Release
22
33on :
4+ push :
5+
6+ pull_request :
7+ branches :
8+ - master
9+
410 release :
511 types : [published]
612
2531 strategy :
2632 matrix :
2733 include :
28- - os : ubuntu-20 .04
34+ - os : ubuntu-22 .04
2935 arch : linux-x64-glibc
36+ - os : ubuntu-22.04-arm
37+ arch : linux-arm64-glibc
3038 - os : macos-13
3139 arch : darwin-x64
3240 - os : macos-14
@@ -61,89 +69,48 @@ jobs:
6169 name : prebuild-${{ matrix.arch }}
6270 path : prebuilds/**/*.node
6371
64- build-linux-arm64-glibc :
65- name : Build for linux-arm64-glibc
66- runs-on : buildjet-2vcpu-ubuntu-2204-arm
67-
68- container :
69- image : node:20-bullseye
72+ build-musl :
73+ strategy :
74+ matrix :
75+ include :
76+ - os : ubuntu-22.04
77+ arch : x64
78+ platform : linux/amd64
79+ - os : ubuntu-22.04-arm
80+ arch : arm64
81+ platform : linux/arm64
82+ - os : ubuntu-22.04-arm
83+ arch : armv7
84+ platform : linux/arm/v7
85+
86+ name : Build for linux-${{ matrix.arch }}-musl
87+ runs-on : ${{ matrix.os }}
7088
7189 steps :
72- - name : Install build deps
73- run : apt update -yq && apt install -yq g++ git make python3
74-
7590 - name : Checkout
7691 uses : actions/checkout@v4
7792 with :
7893 submodules : true
7994
80- - name : Install dependencies
81- run : npm ci
82-
83- - name : Prebuild
84- run : npm run build
85-
86- - name : Upload artifacts
87- uses : actions/upload-artifact@v4
88- with :
89- name : prebuild-linux-arm64-glibc
90- path : prebuilds/**/*.node
91-
92- build-linux-x64-musl :
93- name : Build for linux-x64-musl
94- runs-on : ubuntu-latest
95-
96- container :
97- image : node:20-alpine
98-
99- steps :
100- - name : Install build deps
101- run : apk add --no-cache g++ git make python3
102-
103- - name : Checkout
104- uses : actions/checkout@v4
95+ - name : Set up QEMU
96+ uses : docker/setup-qemu-action@v3
10597 with :
106- submodules : true
107-
108- - name : Install dependencies
109- run : npm ci
98+ platforms : ${{ matrix.platform }}
11099
111100 - name : Prebuild
112- run : npm run build
113-
114- - name : Upload artifacts
115- uses : actions/upload-artifact@v4
101+ uses : addnab/docker-run-action@v3
116102 with :
117- name : prebuild-linux-x64-musl
118- path : prebuilds/**/*.node
119-
120- build-linux-arm64-musl :
121- name : Build for linux-arm64-musl
122- runs-on : ubuntu-latest
123-
124- steps :
125- - name : Checkout
126- uses : actions/checkout@v4
127- with :
128- submodules : true
129-
130- - name : Prebuild
131- uses : uraimo/run-on-arch-action@v2
132- with :
133- arch : aarch64
134- distro : alpine_latest
135- dockerRunArgs : --volume "${PWD}:/repo" --workdir /repo
136- install : |
137- apk add --update make g++ python3
138- apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main/ nodejs~=20 npm
103+ image : node:20-alpine
104+ options : --platform=${{ matrix.platform }} --volume=${{ github.workspace }}:/repo --workdir=/repo
139105 run : |
106+ apk add --no-cache g++ make python3
140107 npm ci
141108 npm run build
142109
143110 - name : Upload artifacts
144111 uses : actions/upload-artifact@v4
145112 with :
146- name : prebuild-linux-arm64 -musl
113+ name : prebuild-linux-${{ matrix.arch }} -musl
147114 path : prebuilds/**/*.node
148115
149116 build-freebsd-x64 :
@@ -172,35 +139,6 @@ jobs:
172139 name : prebuild-freebsd-x64
173140 path : prebuilds/**/*.node
174141
175- build-linux-armv7-musl :
176- name : Build for linux-armv7-musl
177- runs-on : ubuntu-latest
178-
179- steps :
180- - name : Checkout
181- uses : actions/checkout@v4
182- with :
183- submodules : true
184-
185- - name : Prebuild
186- uses : uraimo/run-on-arch-action@v2
187- with :
188- arch : armv7
189- distro : alpine_latest
190- dockerRunArgs : --volume "${PWD}:/repo" --workdir /repo
191- install : |
192- apk add --update make g++ python3
193- apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main/ nodejs~=20 npm
194- run : |
195- npm ci
196- npm run build
197-
198- - name : Upload artifacts
199- uses : actions/upload-artifact@v4
200- with :
201- name : prebuild-linux-armv7-musl
202- path : prebuilds/**/*.node
203-
204142 build-linux-armv7-glibc :
205143 name : Build for linux-armv7-glibc
206144 runs-on : ubuntu-latest
@@ -211,18 +149,20 @@ jobs:
211149 with :
212150 submodules : true
213151
152+ - name : Set up QEMU
153+ uses : docker/setup-qemu-action@v3
154+ with :
155+ platforms : linux/arm/v7
156+
214157 - name : Prebuild
215- uses : uraimo/ run-on-arch- action@v2
158+ uses : addnab/docker- run-action@v3
216159 with :
217- arch : armv7
218- distro : ubuntu_latest
219- dockerRunArgs : --volume "${PWD}:/repo" --workdir /repo
220- install : |
221- apt update -yq
222- apt install -yq curl
223- curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
224- apt install -yq g++ git make python3 nodejs
160+ image : node:20-bullseye
161+ options : --platform=linux/arm/v7 --volume=${{ github.workspace }}:/repo --workdir=/repo
225162 run : |
163+ apt update -yq && apt install -yq wget
164+ wget -qL https://deb.nodesource.com/setup_20.x | bash -
165+ apt install -yq g++ make python3 nodejs
226166 npm ci
227167 npm run build
228168
@@ -242,11 +182,8 @@ jobs:
242182
243183 needs :
244184 - build
185+ - build-musl
245186 - build-freebsd-x64
246- - build-linux-arm64-glibc
247- - build-linux-arm64-musl
248- - build-linux-x64-musl
249- - build-linux-armv7-musl
250187 - build-linux-armv7-glibc
251188
252189 steps :
@@ -273,11 +210,22 @@ jobs:
273210 - name : Move prebuild artifacts
274211 run : mkdir prebuilds && cp --recursive prebuild-*/* prebuilds/
275212
213+ - name : Pack package
214+ run : npm pack
215+ if : ${{ github.event_name == 'push' }}
216+
217+ - name : Upload package artifact
218+ uses : actions/upload-artifact@v4
219+ if : ${{ github.event_name == 'push' }}
220+ with :
221+ name : package
222+ path : ' *.tgz'
223+
276224 - name : Publish to NPM
277225 run : |
278226 npm version --allow-same-version --no-git-tag-version $VERSION
279227 npm publish --provenance --tag $TAG
280- if : ${{ !env.ACT }}
228+ if : ${{ !env.ACT && github.event_name != 'push' }}
281229 env :
282230 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
283231 TAG : ${{ inputs.npm-tag || 'latest' }}
0 commit comments