ci: 修复错误的Version格式

This commit is contained in:
uye
2023-10-15 03:56:07 +08:00
parent 73c41b9c45
commit e8dbc7babb
2 changed files with 8 additions and 19 deletions

View File

@@ -119,12 +119,15 @@ jobs:
run: |
$csprojPath = "src/MaaWpfGui/MaaWpfGui.csproj"
$csprojPath = Resolve-Path -Path $csprojPath
$tag = (Invoke-Expression "git describe --abbrev=0 --tags") -replace '.*?/', ''
$tag -match '\d+(\.\d+){0,3}'
$match = $Matches[0]
[xml]$csproj = Get-Content -Path $csprojPath
$node = $csproj.Project.PropertyGroup | where {$_.AssemblyName -ne $null}
$node.InformationalVersion = '${{ needs.meta.outputs.tag }}'
$node.Version = '${{ needs.meta.outputs.tag }}'
$node.FileVersion = '${{ needs.meta.outputs.tag }}'
$node.AssemblyVersion = '${{ needs.meta.outputs.tag }}'
$node.InformationalVersion = $tag
$node.Version = $match
$node.FileVersion = $match
$node.AssemblyVersion = $match
$csproj.Save($csprojPath)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -28,21 +28,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Taggify Version
run: |
$csprojPath = "src/MaaWpfGui/MaaWpfGui.csproj"
$csprojPath = Resolve-Path -Path $csprojPath
[xml]$csproj = Get-Content -Path $csprojPath
$node = $csproj.Project.PropertyGroup | where {$_.AssemblyName -ne $null}
$node.InformationalVersion = '${{ needs.meta.outputs.tag }}'
$node.Version = '${{ needs.meta.outputs.tag }}'
$node.FileVersion = '${{ needs.meta.outputs.tag }}'
$node.AssemblyVersion = '${{ needs.meta.outputs.tag }}'
$csproj.Save($csprojPath)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: NuGet/setup-nuget@v1.2.0
- run: |
nuget restore MAA.sln