Skip to content

Commit 85cbaf8

Browse files
committed
chore: bump version when releasing
1 parent 0c31717 commit 85cbaf8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
permissions:
11-
contents: read
11+
contents: write
1212
id-token: write
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
1517

1618
- uses: pnpm/action-setup@v4
1719

@@ -21,6 +23,22 @@ jobs:
2123
cache: 'pnpm'
2224
registry-url: 'https://registry.npmjs.org'
2325

26+
- name: Extract version from tag
27+
id: version
28+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
29+
30+
- name: Update package.json version
31+
run: |
32+
pnpm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version --allow-same-version
33+
34+
- name: Commit version bump
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
git add package.json
39+
git commit -m "chore: bump version to ${{ steps.version.outputs.VERSION }}" || echo "No changes to commit"
40+
git push origin HEAD:${{ github.event.release.target_commitish }}
41+
2442
- name: Install dependencies
2543
run: pnpm install --frozen-lockfile
2644

0 commit comments

Comments
 (0)