Skip to content

Commit f022804

Browse files
author
chenjiajun79
committed
fix: publish ci
1 parent 7b8526d commit f022804

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,18 @@ jobs:
241241
shell: bash
242242
- name: Publish
243243
run: |
244-
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
245-
then
246-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
247-
npm publish --access public
248-
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
249-
then
250-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
251-
npm publish --tag next --access public
244+
COMMIT_MSG=$(git log -1 --pretty=%B | head -n1 | xargs)
245+
if [[ "$COMMIT_MSG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
246+
TAG="latest"
247+
elif [[ "$COMMIT_MSG" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
248+
TAG="next"
252249
else
253250
echo "Not a release, skipping publish"
251+
exit 0
254252
fi
253+
254+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
255+
npm publish --tag $TAG --access public
255256
env:
256257
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
257258
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)