Skip to content

Commit 2198022

Browse files
committed
Add error handling for missing prebuilds in GitHub Actions workflow; ensure prebuilds directory is populated before publishing.
1 parent 8c4b832 commit 2198022

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/publish.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
with:
4141
name: prebuilds-${{ matrix.os }}-${{ matrix.arch }}
4242
path: prebuilds
43+
if-no-files-found: error
4344

4445
publish:
4546
needs: prebuilds
@@ -60,7 +61,21 @@ jobs:
6061
with:
6162
path: .
6263
merge-multiple: true
64+
pattern: prebuilds-*
65+
- name: Ensure prebuilds present
66+
run: |
67+
if [ ! -d prebuilds ]; then
68+
echo "prebuilds/ not found, merging artifact directories..."
69+
mkdir -p prebuilds
70+
for dir in prebuilds-*; do
71+
if [ -d "$dir/prebuilds" ]; then
72+
cp -R "$dir/prebuilds/." prebuilds/
73+
fi
74+
done
75+
fi
76+
if ! find prebuilds -name "*.node" | grep -q .; then
77+
echo "No prebuilds found after download."
78+
exit 1
79+
fi
6380
- run: bun scripts/prepublish.ts
6481
- run: bun publish --access public --tag latest
65-
env:
66-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)