Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 223cdc4

Browse files
committed
Enhance publish action
1 parent 8e25bf0 commit 223cdc4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ on:
55

66
jobs:
77
release:
8+
if: github.ref == 'refs/heads/main'
89
runs-on: ubuntu-latest
910
name: Release
1011
steps:
1112
- name: Checkout
1213
uses: actions/checkout@v4
1314

1415
- name: Install pnpm
15-
uses: pnpm/action-setup@v2
16+
uses: pnpm/action-setup@v3
1617

1718
- name: Set node version to 20
1819
uses: actions/setup-node@v4
@@ -29,4 +30,6 @@ jobs:
2930
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3031

3132
- name: Publish
32-
run: pnpm publish --access public --tag latest
33+
run: |
34+
PACKAGE_DIST_TAG=$(node -e "console.log(/^\d+\.\d+\.\d+(\-(\w+)\.\d+)$/.exec(require('./package.json').version)?.[2] || 'latest')")
35+
pnpm publish --access public --tag $PACKAGE_DIST_TAG

0 commit comments

Comments
 (0)