Skip to content

Commit fb7a65d

Browse files
odedha-drclaude
andcommitted
ci: auto-publish to npm on every push to master
Replaces tag-based publishing with automatic patch version bump and publish on every push to master. Uses [skip ci] in the version bump commit to avoid infinite loops. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8fa8136 commit fb7a65d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/publish.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Publish to npm
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches:
6+
- master
77

88
jobs:
99
test:
@@ -19,8 +19,6 @@ jobs:
1919
publish:
2020
needs: test
2121
runs-on: ubuntu-latest
22-
permissions:
23-
contents: write
2422
steps:
2523
- uses: actions/checkout@v4
2624
- uses: actions/setup-node@v4
@@ -29,10 +27,19 @@ jobs:
2927
registry-url: https://registry.npmjs.org
3028
- run: npm ci
3129
- run: npm run build
32-
- run: npm publish --access=public
30+
- name: Bump patch version
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
npm version patch --no-git-tag-version
35+
VERSION=$(node -p "require('./package.json').version")
36+
echo "VERSION=$VERSION" >> $GITHUB_ENV
37+
- name: Publish to npm
38+
run: npm publish --access=public
3339
env:
3440
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35-
- name: Create GitHub Release
36-
run: gh release create ${{ github.ref_name }} --generate-notes
37-
env:
38-
GH_TOKEN: ${{ github.token }}
41+
- name: Push version bump
42+
run: |
43+
git add package.json package-lock.json
44+
git commit -m "chore: bump version to ${{ env.VERSION }} [skip ci]"
45+
git push

0 commit comments

Comments
 (0)