@@ -2,13 +2,20 @@ name: Prepare Release
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ dry_run :
7+ description : Skip creating the draft GitHub release
8+ required : false
9+ default : true
10+ type : boolean
511 push :
612 tags :
713 - ' v*'
814
915env :
1016 APP_NAME : tailwindcss-oxide
1117 NODE_VERSION : 24
18+ PNPM_VERSION : ' 9.6.0'
1219 OXIDE_LOCATION : ./crates/node
1320
1421permissions :
@@ -47,38 +54,32 @@ jobs:
4754 - os : ubuntu-latest
4855 target : x86_64-unknown-linux-gnu
4956 strip : strip
50- container :
51- image : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
57+ build-flags : --use-napi-cross
5258 - os : ubuntu-latest
5359 target : aarch64-unknown-linux-gnu
54- strip : llvm-strip
55- container :
56- image : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
60+ strip : aarch64-linux-gnu-strip
61+ build-flags : --use-napi-cross
5762 - os : ubuntu-latest
5863 target : armv7-unknown-linux-gnueabihf
59- strip : llvm-strip
60-
10BC8
container :
61- image : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig
64+ strip : arm-linux-gnueabihf-strip
65+ build-flags : --use-napi-cross
6266 - os : ubuntu-latest
6367 target : aarch64-unknown-linux-musl
64- strip : aarch64-linux-musl-strip
65- download : true
66- container :
67- image : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
68+ strip-zig : true
69+ build-flags : -x
6870 - os : ubuntu-latest
6971 target : x86_64-unknown-linux-musl
7072 strip : strip
71- download : true
72- container :
73- image : ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
73+ build-flags : -x
7474
7575 name : Build ${{ matrix.target }} (oxide)
7676 runs-on : ${{ matrix.os }}
77- container : ${{ matrix.container }}
7877 timeout-minutes : 15
7978 steps :
8079 - uses : actions/checkout@v6
81- - uses : pnpm/action-setup@v4
80+ - uses : pnpm/action-setup@v6
81+ with :
82+ version : ${{ env.PNPM_VERSION }}
8283
8384 - name : Use Node.js ${{ env.NODE_VERSION }}
8485 uses : actions/setup-node@v6
9293 sudo apt-get update
9394 sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
9495
96+ - name : Install binutils-aarch64-linux-gnu
97+ if : ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
98+ run : |
99+ sudo apt-get update
100+ sudo apt-get install binutils-aarch64-linux-gnu -y
101+
95102 # Cargo already skips downloading dependencies if they already exist
96103 - name : Cache cargo
97104 uses : actions/cache@v5
@@ -101,6 +108,8 @@ jobs:
101108 ~/.cargo/registry/index/
102109 ~/.cargo/registry/cache/
103110 ~/.cargo/git/db/
111+ ~/.napi-rs
112+ .cargo-cache
104113 target/
105114 key : ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
106115
@@ -120,15 +129,18 @@ jobs:
120129 ./crates/node/wasi-worker.mjs
121130 key : ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
122131
123- - name : Install Node.JS
124- uses : actions/setup-node@v6
132+ - uses : mlugg/setup-zig@v2
133+ if : ${{ contains(matrix.target, 'musl') }}
125134 with :
126- node- version : ${{ env.NODE_VERSION }}
135+ version : 0.14.1
127136
128- - name : Install Rust (Stable)
129- if : ${{ matrix.download }}
130- run : |
131- rustup default stable
137+ - name : Install cargo-zigbuild
138+ uses : taiki-e/install-action@v2
139+ if : ${{ contains(matrix.target, 'musl') }}
140+ env :
141+ GITHUB_TOKEN : ${{ github.token }}
142+ with :
143+ tool : cargo-zigbuild
132144
133145 - name : Setup rust target
134146 run : rustup target add ${{ matrix.target }}
@@ -137,14 +149,26 @@ jobs:
137149 run : pnpm install --ignore-scripts --filter=!./playgrounds/*
138150
139151 - name : Build release
140- run : pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=${{ matrix.target }}
152+ run : pnpm run --filter ${{ env.OXIDE_LOCATION }} build:platform --target=${{ matrix.target }} ${{ matrix.build-flags }}
141153 env :
142154 RUST_TARGET : ${{ matrix.target }}
143155 JEMALLOC_SYS_WITH_LG_PAGE : ${{ matrix.page-size }}
144156
145157 - name : Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
146- if : ${{ matrix.strip }}
147- run : ${{ matrix.strip }} ${{ env.OXIDE_LOCATION }}/*.node
158+ if : ${{ matrix.strip || matrix.strip-zig }}
159+ env :
160+ STRIP_COMMAND : ${{ matrix.strip }}
161+ STRIP_ZIG : ${{ matrix.strip-zig }}
162+ run : |
163+ if [ "$STRIP_ZIG" = "true" ]; then
164+ for file in ${{ env.OXIDE_LOCATION }}/*.node; do
165+ zig objcopy --strip-all "$file" "$file.stripped"
166+ mv "$file.stripped" "$file"
167+ done
168+ exit 0
169+ fi
170+
171+ eval "$STRIP_COMMAND ${{ env.OXIDE_LOCATION }}/*.node"
148172
149173 - name : Upload artifacts
150174 uses : actions/upload-artifact@v6
@@ -175,7 +199,7 @@ jobs:
175199 shell : bash
176200 run : |
177201 sudo pkg install -y -f curl node libnghttp2 npm
178- sudo npm install -g pnpm@9.6.0 --unsafe-perm=true
202+ sudo npm install -g pnpm@${{ env.PNPM_VERSION }} --unsafe-perm=true
179203 curl -sSf https://static.rust-lang.org/rustup/archive/1.27.1/x86_64-unknown-freebsd/rustup-init --output rustup-init
180204 chmod +x rustup-init
181205 ./rustup-init -y --profile minimal
@@ -222,7 +246,9 @@ jobs:
222246 run : |
223247 echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
224248
225- - uses : pnpm/action-setup@v4
249+ - uses : pnpm/action-setup@v6
250+ with :
251+ version : ${{ env.PNPM_VERSION }}
226252
227253 - name : Use Node.js ${{ env.NODE_VERSION }}
228254 uses : actions/setup-node@v6
@@ -317,6 +343,7 @@ jobs:
317343 path : dist/*.tgz
318344
319345 - name : Prepare GitHub Release
346+ if : ${{ !inputs.dry_run }}
320347 uses : softprops/action-gh-release@v2
321348 with :
322349 draft : true
0 commit comments