Skip to content

Commit 637bf4f

Browse files
ci: update & improve workflows
Update actions & Node.js and use arm runners
1 parent 4569e9a commit 637bf4f

File tree

3 files changed

+30
-44
lines changed

3 files changed

+30
-44
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
76
pull_request:
8-
branches:
9-
- master
7+
branches: [master]
108
workflow_call:
119

1210
concurrency:
@@ -18,58 +16,49 @@ jobs:
1816
strategy:
1917
matrix:
2018
os:
21-
- windows-latest
22-
- macos-latest
19+
- windows-2022
20+
- windows-11-arm
21+
- macos-15
22+
- macos-13
2323
- ubuntu-22.04
24+
- ubuntu-22.04-arm
2425
node:
25-
- 18
26-
- 20
27-
- 22
26+
- 20.19.5
27+
- 22.19.0
28+
- 24.7.0
2829
fail-fast: false
29-
name: Test Node ${{ matrix.node }} on ${{ matrix.os }}
30-
runs-on: ${{ matrix.os }}
30+
name: Test Node ${{matrix.node}} on ${{matrix.os}}
31+
runs-on: ${{matrix.os}}
3132
defaults:
3233
run:
3334
shell: bash
3435
steps:
3536
- name: Checkout repository
36-
uses: actions/checkout@v4
37+
uses: actions/checkout@v5
3738
with:
3839
submodules: true
39-
fetch-depth: 0
4040

4141
- name: Setup Node
42-
uses: actions/setup-node@v4
42+
uses: actions/setup-node@v5
4343
with:
44-
node-version: ${{ matrix.node }}
45-
46-
- name: Install dependencies
47-
run: npm ci --legacy-peer-deps
44+
node-version: ${{matrix.node}}
4845

4946
- name: Set npm_config_target
50-
run: echo "CONFIG_TARGET=${{ matrix.node == 22 && '22.12.0' || '20.9.0' }}" >> $GITHUB_ENV
47+
run: printf 'npm_config_target=${{matrix.node}}\n' >> "$GITHUB_ENV"
5148

52-
- name: Build x64 binary
53-
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch x64 -t 20.9.0
54-
55-
- name: Set up cross-compilation
56-
if: runner.os == 'Linux'
57-
run: |-
58-
sudo apt-get update
59-
sudo apt-get install g++-aarch64-linux-gnu
60-
printf '%s\n' >> "$GITHUB_ENV" \
61-
'CC=aarch64-linux-gnu-gcc' 'CXX=aarch64-linux-gnu-g++'
49+
- name: Install dependencies
50+
run: npm ci --legacy-peer-deps
6251

63-
- name: Build arm64 binary
64-
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch arm64 -t 20.9.0
52+
- name: Build binary
53+
run: npm x -- prebuildify --napi
6554

6655
- name: Run tests
6756
run: npm test
6857

6958
- name: Upload prebuilds
7059
uses: actions/upload-artifact@v4
71-
if: github.ref_type == 'tag' && matrix.node == 20
60+
if: github.ref_type == 'tag' && startsWith(matrix.node, '20')
7261
with:
7362
path: prebuilds/**
74-
name: prebuilds-${{matrix.os}}
63+
name: prebuilds-${{runner.os}}-${{runner.arch}}
7564
retention-days: 2

.github/workflows/docs.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ jobs:
2626
url: ${{steps.deployment.outputs.page_url}}
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
3030
with:
3131
submodules: true
32-
fetch-depth: 0
3332
- name: Setup Node.js
34-
uses: actions/setup-node@v4
33+
uses: actions/setup-node@v5
3534
with:
3635
node-version: 20
3736
cache: 'npm'
@@ -40,7 +39,7 @@ jobs:
4039
- name: Generate documentation
4140
run: npm run docs
4241
- name: Upload pages artifact
43-
uses: actions/upload-pages-artifact@v3
42+
uses: actions/upload-pages-artifact@v4
4443
with:
4544
path: docs/api
4645
- name: Deploy to GitHub Pages

.github/workflows/publish.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
submodules: true
21-
fetch-depth: 0
2221

2322
- name: Setup Node
24-
uses: actions/setup-node@v4
23+
uses: actions/setup-node@v5
2524
with:
2625
node-version: 20
2726
registry-url: https://registry.npmjs.org
2827

2928
- name: Download prebuilds
30-
uses: actions/download-artifact@v4
29+
uses: actions/download-artifact@v5
3130
with:
3231
path: prebuilds
3332
pattern: prebuilds-*
@@ -42,7 +41,7 @@ jobs:
4241
- name: Publish to NPM
4342
run: npm publish
4443
env:
45-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4645

4746
- name: Prepare release artifacts
4847
run: |
@@ -54,7 +53,6 @@ jobs:
5453
ls -l dist
5554
5655
- name: Create release
57-
run: |-
58-
gh release create ${{ github.ref_name }} --generate-notes dist/*
56+
run: gh release create "$GITHUB_REF_NAME" --generate-notes dist/*
5957
env:
60-
GH_TOKEN: ${{ github.token }}
58+
GH_TOKEN: ${{github.token}}

0 commit comments

Comments
 (0)