From 17d1978f2b909618ce05fe4d7ea513eb9739599d Mon Sep 17 00:00:00 2001 From: PuqiAR Date: Sat, 3 Jan 2026 22:23:16 +0800 Subject: [PATCH] =?UTF-8?q?[CI]=20=E4=B8=8D=E5=B0=8F=E5=BF=83=E5=86=99?= =?UTF-8?q?=E5=88=B0linux=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 80321c1..3355cef 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -31,14 +31,13 @@ jobs: - name: 设置版本 run: | - if ('${{ github.event_name }}' -eq 'workflow_dispatch') { - $VERSION = '${{ inputs.version }}' - } else { - $VERSION = '${{ github.ref }}' -replace 'refs/tags/', '' - } - Write-Host "构建版本: $VERSION" - # Gitea Actions 设置环境变量的正确方式 - echo "VERSION=$VERSION" >> $env:GITHUB_ENV + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="${{ inputs.version }}" + else + VERSION="${GITHUB_REF#refs/tags/}" + fi + echo "构建版本: $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: 构建项目 (Linux) run: | @@ -145,16 +144,14 @@ jobs: - name: 设置版本 run: | - powershell -Command " - if ('${{ github.event_name }}' -eq 'workflow_dispatch') { - `$VERSION = '${{ inputs.version }}' - } else { - `$VERSION = '${{ github.ref }}' -replace 'refs/tags/', '' - } - # 设置环境变量 - Add-Content -Path `$env:GITHUB_ENV -Value \"VERSION=`$VERSION\" - Write-Host \"Windows构建版本: `$VERSION\" - " + if ('${{ github.event_name }}' -eq 'workflow_dispatch') { + $VERSION = '${{ inputs.version }}' + } else { + $VERSION = '${{ github.ref }}' -replace 'refs/tags/', '' + } + Write-Host "构建版本: $VERSION" + # Gitea Actions 设置环境变量的正确方式 + echo "VERSION=$VERSION" >> $env:GITHUB_ENV - name: 构建项目 (Windows Native) run: |