Skip to content

Commit c947af3

Browse files
committed
fix: 修复 CI 版本提取脚本语法错误
1 parent 079a9c0 commit c947af3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ jobs:
3737

3838
- name: Extract version and update package.json
3939
run: |
40-
# 从 git tag 获取版本号
41-
VERSION=${GITHUB_REF#refs/tags/v}
42-
VERSION=${VERSION#${{ github.event.inputs.version != '' && github.event.inputs.version || '' }}
40+
# 从 git tag 获取版本号 (例如 v0.3.8 -> 0.3.8)
41+
VERSION="${GITHUB_REF#refs/tags/v}"
4342
# 如果是 workflow_dispatch 且指定了版本
4443
if [ "${{ github.event.inputs.version }}" != "" ] && [ "${{ github.event.inputs.version }}" != "test" ]; then
4544
VERSION="${{ github.event.inputs.version }}"
4645
fi
4746
echo "Building version: $VERSION"
4847
# 更新 package.json
49-
npm version $VERSION --no-git-tag-version
48+
npm version "$VERSION" --no-git-tag-version
5049
shell: bash
5150

5251
- name: Set up Node.js

0 commit comments

Comments
 (0)