File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,27 @@ jobs:
3737 run : |
3838 git config --local user.email "${{ github.actor }}@users.noreply.github.com"
3939 git config --local user.name "${{ github.actor }}"
40- git tag v${{ steps.version.outputs.version }}
41- git push origin v${{ steps.version.outputs.version }}
40+ TAG_NAME="v${{ steps.version.outputs.version }}"
41+ if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
42+ echo "Tag $TAG_NAME already exists, skipping tag creation"
43+ else
44+ echo "Creating tag $TAG_NAME"
45+ git tag "$TAG_NAME"
46+ git push origin "$TAG_NAME"
47+ fi
4248
4349 - name : Publish
4450 env :
4551 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4652 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
4753 run : |
4854 echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
49- npm publish
55+ npm publish || {
56+ if [[ $? -eq 1 && $(npm view @dashscope-js/claude-code-config@${{ steps.version.outputs.version }} version 2>/dev/null) == "${{ steps.version.outputs.version }}" ]]; then
57+ echo "Version ${{ steps.version.outputs.version }} already exists on npm, skipping publish"
58+ exit 0
59+ else
60+ echo "Publish failed with error code $?"
61+ exit 1
62+ fi
63+ }
You can’t perform that action at this time.
0 commit comments