From 59141b0241e98f1a19010b2188f5f2e13afbbc85 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Fri, 3 Oct 2025 11:04:00 +0800 Subject: [PATCH 1/2] test action --- .github/workflows/prerelease.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index d9263ea7..2ddcc17a 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -46,7 +46,20 @@ jobs: - name: Get current version id: get_version run: | - $version = (Get-Content "Ink Canvas\Properties\AssemblyInfo.cs" | Select-String "AssemblyVersion\(""([^""]+)""\)").Matches[0].Groups[1].Value + $versionLine = Get-Content "Ink Canvas\Properties\AssemblyInfo.cs" | Select-String "AssemblyVersion\(""([^""]+)""\)" + if ($versionLine) { + $version = $versionLine.Matches[0].Groups[1].Value + # 处理通配符版本号 + if ($version -match "(\d+)\.(\d+)\.(\*|\d+)\.(\*|\d+)") { + $major = $matches[1] + $minor = $matches[2] + $patch = if ($matches[3] -eq "*") { "0" } else { $matches[3] } + $revision = if ($matches[4] -eq "*") { "0" } else { $matches[4] } + $version = "$major.$minor.$patch.$revision" + } + } else { + $version = "1.0.0.0" + } echo "current_version=$version" >> $env:GITHUB_OUTPUT echo "Current version: $version" @@ -55,9 +68,17 @@ jobs: run: | $currentVersion = "${{ steps.get_version.outputs.current_version }}" $versionParts = $currentVersion.Split('.') - $major = [int]$versionParts[0] - $minor = [int]$versionParts[1] - $patch = [int]$versionParts[2] + + # 确保版本号格式正确 + if ($versionParts.Length -ge 3) { + $major = [int]$versionParts[0] + $minor = [int]$versionParts[1] + $patch = [int]$versionParts[2] + } else { + $major = 1 + $minor = 0 + $patch = 0 + } $versionType = "${{ github.event.inputs.version_type }}" From 034db2fc275d7f6a9c7c909778f976ae1dc0433b Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Fri, 3 Oct 2025 11:07:58 +0800 Subject: [PATCH 2/2] test action --- .github/workflows/prerelease.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 2ddcc17a..bdc94936 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -25,15 +25,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v4.2.2 with: fetch-depth: 0 # 获取所有历史记录用于生成changelog - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.0.x' - - name: Setup MSbuild uses: microsoft/setup-msbuild@v2 @@ -254,7 +249,7 @@ jobs: echo "archive_name=$archiveName" >> $env:GITHUB_OUTPUT - name: Upload Release Assets - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4.5.0 with: name: release-files-${{ steps.calc_version.outputs.new_version }} path: |