Skip to content

Commit 311de49

Browse files
sweetmantechclaude
andcommitted
fix: auto-bump patch version on every merge to main before publishing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 60e402c commit 311de49

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
publish:
1313
runs-on: ubuntu-latest
1414
permissions:
15-
contents: read
15+
contents: write
1616
steps:
1717
- uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
1820

1921
- uses: pnpm/action-setup@v4
2022
with:
@@ -31,18 +33,17 @@ jobs:
3133

3234
- run: pnpm build
3335

34-
- name: Check if version already published
35-
id: version-check
36+
- name: Bump patch version
3637
run: |
37-
LOCAL_VERSION=$(node -p "require('./package.json').version")
38-
if npm view @recoupable/cli@$LOCAL_VERSION version 2>/dev/null; then
39-
echo "published=true" >> $GITHUB_OUTPUT
40-
else
41-
echo "published=false" >> $GITHUB_OUTPUT
42-
fi
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
npm version patch --no-git-tag-version
41+
VERSION=$(node -p "require('./package.json').version")
42+
git add package.json
43+
git commit -m "chore: bump version to $VERSION [skip ci]"
44+
git push
4345
4446
- name: Publish to npm
45-
if: steps.version-check.outputs.published == 'false'
4647
run: pnpm publish --no-git-checks
4748
env:
4849
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)