Skip to content

Commit 73d23a4

Browse files
committed
npm publish step
1 parent 8d3b94c commit 73d23a4

File tree

2 files changed

+27
-56
lines changed

2 files changed

+27
-56
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Tests
22

3+
permissions:
4+
contents: write
5+
36
on:
47
push:
58
branches: ["**"]
@@ -52,3 +55,27 @@ jobs:
5255

5356
- name: Run tests
5457
run: bun run test
58+
59+
- name: Configure Git
60+
if: matrix.arch == 'x86-64' && github.ref == 'refs/heads/main' && github.event_name == 'push'
61+
run: |
62+
git config --global user.name "github-actions[bot]"
63+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64+
65+
- name: Bump version and create tag
66+
if: matrix.arch == 'x86-64' && github.ref == 'refs/heads/main' && github.event_name == 'push'
67+
run: |
68+
npm version patch --no-git-tag-version
69+
NEW_VERSION=$(node -p "require('./package.json').version")
70+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
71+
git add package.json
72+
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
73+
git tag "v$NEW_VERSION"
74+
git push origin main
75+
git push origin "v$NEW_VERSION"
76+
77+
- name: Publish to NPM
78+
if: matrix.arch == 'x86-64' && github.ref == 'refs/heads/main' && github.event_name == 'push'
79+
run: npm publish --no-git-checks --access public
80+
env:
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)