Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
stamepicmorg committed Sep 29, 2024
1 parent 6d1f62f commit dded119
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,24 @@ jobs:
$current_version = (Select-String -Path $version_file -Pattern '<Version>(.*?)</Version>' | ForEach-Object { $_.Matches.Groups[1].Value })
if (-not $current_version) {
throw "Не удалось получить текущую версию из $version_file"
}
$build_number = ${GITHUB_RUN_NUMBER}
$new_version = "${current_version.Split('.')[0..1] -join '.'}.${build_number}"
(Get-Content $version_file) -replace '<Version>.*</Version>', "<Version>$new_version</Version>" | Set-Content $version_file
(Get-Content $version_file) -replace '<AssemblyVersion>.*</AssemblyVersion>', "<AssemblyVersion>${new_version}.0</AssemblyVersion>" | Set-Content $version_file
echo "new_version=$new_version" >> $GITHUB_ENV
if ($new_version -match '^\d+\.\d+\.\d+$') {
(Get-Content $version_file) -replace '<Version>.*</Version>', "<Version>$new_version</Version>" | Set-Content $version_file
(Get-Content $version_file) -replace '<AssemblyVersion>.*</AssemblyVersion>', "<AssemblyVersion>${new_version}.0</AssemblyVersion>" | Set-Content $version_file
echo "new_version=$new_version" >> $GITHUB_ENV
} else {
throw "Некорректный формат новой версии: $new_version"
}
shell: pwsh


- name: Build
run: dotnet build --configuration ${{ matrix.configuration }} --verbosity minimal

Expand Down

0 comments on commit dded119

Please sign in to comment.