Skip to content

Commit e4ae716

Browse files
committed
ci: rework release workflow
1 parent 5fb750e commit e4ae716

File tree

3 files changed

+47
-34
lines changed

3 files changed

+47
-34
lines changed
Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
name: build
1+
name: Build
22

33
on:
44
push:
55
branches:
66
- master
7-
tags:
8-
- v*
97
pull_request:
108
branches:
119
- master
10+
workflow_call:
1211

1312
concurrency:
1413
group: ${{github.workflow}}-${{github.ref}}
1514
cancel-in-progress: true
1615

17-
1816
jobs:
1917
test:
2018
strategy:
2119
matrix:
2220
os:
23-
- windows-2022
24-
- macos-14
25-
- ubuntu-20.04
21+
- windows-latest
22+
- macos-latest
23+
- ubuntu-latest
2624
node:
2725
- 18
2826
- 20
27+
- 22
2928
fail-fast: false
3029
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
3130
runs-on: ${{ matrix.os }}
@@ -37,38 +36,15 @@ jobs:
3736
- uses: actions/setup-node@v4
3837
with:
3938
node-version: ${{ matrix.node }}
39+
4040
- run: npm install
41-
- run: npm run build -- --arch x64
42-
- run: npm run build -- --arch arm64
41+
- run: npm run build_x64
42+
- run: npm run build_arm64
4343
- run: npm test
44+
4445
- uses: actions/upload-artifact@v4
4546
if: github.ref_type == 'tag' && matrix.node == 20
4647
with:
4748
path: prebuilds/**
4849
name: prebuilds-${{matrix.os}}
4950
retention-days: 2
50-
51-
publish:
52-
if: github.ref_type == 'tag'
53-
name: Publish to npm
54-
runs-on: ubuntu-20.04
55-
needs: [test]
56-
steps:
57-
- uses: actions/checkout@v4
58-
with:
59-
submodules: true
60-
fetch-depth: 0
61-
- uses: actions/setup-node@v4
62-
with:
63-
node-version: 20
64-
registry-url: https://registry.npmjs.org
65-
- uses: actions/download-artifact@v4
66-
with:
67-
path: prebuilds
68-
pattern: prebuilds-*
69-
merge-multiple: true
70-
- run: tree prebuilds
71-
- run: npm install
72-
- run: npm publish
73-
env:
74-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
8+
jobs:
9+
build:
10+
uses: "./.github/workflows/ci.yml"
11+
12+
publish:
13+
if: github.ref_type == 'tag'
14+
name: Publish to npm
15+
runs-on: ubuntu-20.04
16+
needs: [test]
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
fetch-depth: 0
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
registry-url: https://registry.npmjs.org
26+
- uses: actions/download-artifact@v4
27+
with:
28+
path: prebuilds
29+
pattern: prebuilds-*
30+
merge-multiple: true
31+
- run: tree prebuilds
32+
- run: npm install
33+
- run: npm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"scripts": {
5353
"install": "node-gyp-build",
5454
"build": "prebuildify --napi --strip",
55+
"build_x64": "prebuildify --napi --strip --arch x64",
56+
"build_arm64": "prebuildify --napi --strip --arch arm64",
5557
"rebuild": "node-gyp rebuild",
5658
"test": "node --test test/**/*.js"
5759
},

0 commit comments

Comments
 (0)