From 8ab25fe293ce82b5f2a7a1a06a99c5157445152d Mon Sep 17 00:00:00 2001 From: yhh <359807859@qq.com> Date: Sun, 23 Nov 2025 22:49:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BD=BF=E7=94=A8=E7=BA=AF=20bash+n?= =?UTF-8?q?ode=20=E5=AE=9E=E7=8E=B0=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=BB=95=E8=BF=87=20workspace=20=E5=8D=8F=E8=AE=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f60e0c1..5d3a1a6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,11 +72,19 @@ jobs: run: | cd packages/${{ github.event.inputs.package }} if [ "${{ github.event.inputs.version_type }}" = "custom" ]; then - pnpm version ${{ github.event.inputs.custom_version }} --no-git-tag-version --allow-same-version + NEW_VERSION=${{ github.event.inputs.custom_version }} else - pnpm version ${{ github.event.inputs.version_type }} --no-git-tag-version + # Get current version and bump it + CURRENT=$(node -p "require('./package.json').version") + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" + case "${{ github.event.inputs.version_type }}" in + major) NEW_VERSION="$((MAJOR+1)).0.0" ;; + minor) NEW_VERSION="$MAJOR.$((MINOR+1)).0" ;; + patch) NEW_VERSION="$MAJOR.$MINOR.$((PATCH+1))" ;; + esac fi - NEW_VERSION=$(node -p "require('./package.json').version") + # Update package.json using node + node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json')); pkg.version='$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)+'\n')" echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT echo "发布版本: $NEW_VERSION"