@@ -238,35 +238,46 @@ jobs:
238238 - name : Update npm for trusted publishing
239239 run : npm install -g npm@latest
240240
241- - name : Stage binaries
241+ - name : Stage binaries into platform packages
242242 run : |
243- mkdir -p npm/socket-patch/bin
244- tar xzf artifacts/socket-patch-aarch64-apple-darwin.tar.gz -C npm/socket-patch/bin/
245- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-darwin-arm64
246- tar xzf artifacts/socket-patch-x86_64-apple-darwin.tar.gz -C npm/socket-patch/bin/
247- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-darwin-x64
248- tar xzf artifacts/socket-patch-x86_64-unknown-linux-musl.tar.gz -C npm/socket-patch/bin/
249- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-linux-x64
250- tar xzf artifacts/socket-patch-aarch64-unknown-linux-gnu.tar.gz -C npm/socket-patch/bin/
251- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-linux-arm64
252- tar xzf artifacts/socket-patch-arm-unknown-linux-gnueabihf.tar.gz -C npm/socket-patch/bin/
253- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-linux-arm
254- tar xzf artifacts/socket-patch-i686-unknown-linux-gnu.tar.gz -C npm/socket-patch/bin/
255- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-linux-ia32
256- tar xzf artifacts/socket-patch-aarch64-linux-android.tar.gz -C npm/socket-patch/bin/
257- mv npm/socket-patch/bin/socket-patch npm/socket-patch/bin/socket-patch-android-arm64
258- cd npm/socket-patch/bin
259- unzip ../../../artifacts/socket-patch-x86_64-pc-windows-msvc.zip
260- mv socket-patch.exe socket-patch-win32-x64.exe
261- unzip ../../../artifacts/socket-patch-i686-pc-windows-msvc.zip
262- mv socket-patch.exe socket-patch-win32-ia32.exe
263- unzip ../../../artifacts/socket-patch-aarch64-pc-windows-msvc.zip
264- mv socket-patch.exe socket-patch-win32-arm64.exe
243+ # Unix platforms: extract binary into each platform package directory
244+ stage_unix() {
245+ local artifact="$1" pkg_dir="$2"
246+ tar xzf "artifacts/${artifact}.tar.gz" -C "${pkg_dir}/"
247+ }
248+
249+ # Windows platforms: extract .exe into each platform package directory
250+ stage_win() {
251+ local artifact="$1" pkg_dir="$2"
252+ unzip -o "artifacts/${artifact}.zip" -d "${pkg_dir}/"
253+ }
254+
255+ stage_unix socket-patch-aarch64-apple-darwin npm/socket-patch-darwin-arm64
256+ stage_unix socket-patch-x86_64-apple-darwin npm/socket-patch-darwin-x64
257+ stage_unix socket-patch-x86_64-unknown-linux-musl npm/socket-patch-linux-x64
258+ stage_unix socket-patch-aarch64-unknown-linux-gnu npm/socket-patch-linux-arm64
259+ stage_unix socket-patch-arm-unknown-linux-gnueabihf npm/socket-patch-linux-arm
260+ stage_unix socket-patch-i686-unknown-linux-gnu npm/socket-patch-linux-ia32
261+ stage_unix socket-patch-aarch64-linux-android npm/socket-patch-android-arm64
262+
263+ stage_win socket-patch-x86_64-pc-windows-msvc npm/socket-patch-win32-x64
264+ stage_win socket-patch-i686-pc-windows-msvc npm/socket-patch-win32-ia32
265+ stage_win socket-patch-aarch64-pc-windows-msvc npm/socket-patch-win32-arm64
266+
267+ - name : Publish platform packages
268+ run : |
269+ for pkg_dir in npm/socket-patch-*/; do
270+ echo "Publishing ${pkg_dir}..."
271+ npm publish "./${pkg_dir}" --provenance --access public
272+ done
273+
274+ - name : Wait for npm registry propagation
275+ run : sleep 30
265276
266277 - name : Copy README for npm package
267278 run : cp README.md npm/socket-patch/README.md
268279
269- - name : Publish package
280+ - name : Publish main package
270281 run : npm publish ./npm/socket-patch --provenance --access public
271282
272283 pypi-publish :
@@ -292,6 +303,9 @@ jobs:
292303 with :
293304 python-version : ' 3.12'
294305
306+ - name : Copy README for PyPI package
307+ run : cp README.md pypi/socket-patch/README.md
308+
295309 - name : Build platform wheels
296310 run : |
297311 VERSION="${{ needs.sync-and-tag.outputs.version }}"
0 commit comments