We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c14283 commit c9e3843Copy full SHA for c9e3843
1 file changed
.github/workflows/release.yml
@@ -80,6 +80,21 @@ jobs:
80
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
81
fi
82
83
+ - name: 检查版本是否已存在
84
+ id: check_version
85
+ run: |
86
+ VERSION=${{ steps.get_version.outputs.version }}
87
+ PACKAGE_NAME=$(node -p "require('./package.json').name")
88
+
89
+ # 检查版本是否已在npm上发布
90
+ if npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null; then
91
+ echo "❌ 版本 $VERSION 已存在于 npm 上"
92
+ echo "请使用新的版本号重新发布"
93
+ exit 1
94
+ else
95
+ echo "✅ 版本 $VERSION 可以发布"
96
+ fi
97
98
- name: 更新版本号 (手动触发时)
99
if: github.event_name == 'workflow_dispatch'
100
run: |
0 commit comments