Skip to content

Commit 33f54dc

Browse files
committed
update publish workflow
1 parent 0203da9 commit 33f54dc

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

.github/workflows/publish.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,54 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v*"
79

810
jobs:
9-
build:
11+
version-bump:
1012
runs-on: ubuntu-latest
13+
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]')
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "24"
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 9
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Build
34+
run: pnpm run build
35+
36+
- name: Configure Git
37+
run: |
38+
git config --global user.name "github-actions[bot]"
39+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
40+
41+
- name: Bump version and create tag
42+
run: |
43+
pnpm version patch --no-git-tag-version
44+
NEW_VERSION=$(node -p "require('./package.json').version")
45+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
46+
git add package.json
47+
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
48+
git tag "v$NEW_VERSION"
49+
git push origin main
50+
git push origin "v$NEW_VERSION"
51+
52+
publish:
53+
runs-on: ubuntu-latest
54+
if: startsWith(github.ref, 'refs/tags/v')
1155
steps:
1256
- name: Checkout code
1357
uses: actions/checkout@v4

0 commit comments

Comments
 (0)