Skip to content

Commit 04d2c87

Browse files
committed
ci: fix git config and prebuild merging
1 parent 2b37da4 commit 04d2c87

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

.github/workflows/prebuild.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
- uses: actions/checkout@v4
1717
with:
1818
submodules: recursive
19-
19+
2020
- uses: actions/setup-node@v4
2121
with:
2222
node-version: 22
23-
23+
2424
- run: npm install
25-
- run: npx prebuildify --napi --strip || echo "Prebuildify failed, prebuilds may already exist"
26-
25+
- run: npx prebuildify --napi --strip || echo "Prebuildify may have failed"
26+
2727
- uses: actions/upload-artifact@v4
2828
with:
2929
name: prebuilds-${{ matrix.os }}
@@ -34,28 +34,43 @@ jobs:
3434
needs: build
3535
runs-on: ubuntu-latest
3636
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
37-
37+
3838
steps:
3939
- uses: actions/checkout@v4
4040
with:
4141
submodules: recursive
42-
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Configure Git
45+
run: |
46+
git config user.name "github-actions[bot]"
47+
git config user.email "github-actions[bot]@users.noreply.github.com"
48+
4349
- uses: actions/setup-node@v4
4450
with:
4551
node-version: 22
4652
registry-url: https://registry.npmjs.org
47-
53+
4854
- uses: actions/download-artifact@v4
4955
with:
5056
path: artifacts
51-
52-
- run: |
57+
58+
- name: Merge prebuilds
59+
run: |
5360
mkdir -p prebuilds
54-
find artifacts -name "*.node" -exec sh -c 'cp "$1" prebuilds/$(basename $(dirname "$1"))/' _ {} \;
55-
61+
find artifacts -type f -name "*.node" | while read src; do
62+
platform=$(basename $(dirname $(dirname "$src")) | sed 's/prebuilds-//')
63+
mkdir -p "prebuilds/$platform"
64+
cp "$src" "prebuilds/$platform/"
65+
done
66+
ls -R prebuilds/ || echo "No prebuilds found"
67+
5668
- run: npm install
57-
- run: npm version patch
58-
- run: git push && git push --tags
59-
- run: npm publish --access public
69+
70+
- name: Bump version and publish
71+
run: |
72+
npm version patch -m "chore: release %s with prebuilds"
73+
git push && git push --tags
74+
npm publish --access public
6075
env:
6176
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)