Skip to content

Commit 1889f0d

Browse files
committed
chore(release): 兼容预发布版本的发布流程
1 parent c3975d9 commit 1889f0d

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ jobs:
8080
with:
8181
files: artifacts/*.tgz
8282
generate_release_notes: true
83+
prerelease: ${{ contains(github.ref_name, '-') }}
8384
env:
8485
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8586

@@ -107,7 +108,13 @@ jobs:
107108
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
108109

109110
- name: Publish to npm
110-
run: npm publish --access public
111+
run: |
112+
PKG_VER="$(node -p "require('./package.json').version")"
113+
if [[ "$PKG_VER" == *-* ]]; then
114+
npm publish --access public --tag next
115+
else
116+
npm publish --access public
117+
fi
111118
env:
112119
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
113120

@@ -140,6 +147,12 @@ jobs:
140147
GITHUB_REPOSITORY_OWNER: ${{ env.NPM_SCOPE_OWNER }}
141148

142149
- name: Publish to GitHub Packages
143-
run: npm publish
150+
run: |
151+
PKG_VER="$(node -p "require('./package.json').version")"
152+
if [[ "$PKG_VER" == *-* ]]; then
153+
npm publish --tag next
154+
else
155+
npm publish
156+
fi
144157
env:
145158
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)