Get version from the release tag

This commit is contained in:
Alexander Shabarshov 2026-05-16 21:00:27 +01:00
parent 80a346583d
commit d46dda1271

View File

@ -2,9 +2,8 @@ name: Build and Publish
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
tags:
- 'v*'
jobs:
build:
@ -22,18 +21,22 @@ jobs:
- name: Restore
run: dotnet restore -r win-x64
- name: 'Get Version'
id: version
uses: battila7/get-version-action@v2
- name: Build Release
run: dotnet build -c Release --no-restore /p:BuildNumber=${{ github.run_number }} /p:SourceRevisionId=${{ github.sha }}
run: dotnet build -c Release --no-restore -r win-x64 /p:Version=${{ steps.version.outputs.version-without-v }} /p:BuildNumber=${{ github.run_number }} /p:SourceRevisionId=${{ github.sha }}
- name: Publish Release
run: dotnet publish -c Release -r win-x64 --self-contained true --no-build /p:BuildNumber=${{ github.run_number }} /p:SourceRevisionId=${{ github.sha }}
run: dotnet publish -c Release -r win-x64 --self-contained true --no-build /p:Version=${{ steps.version.outputs.version-without-v }} /p:BuildNumber=${{ github.run_number }} /p:SourceRevisionId=${{ github.sha }}
- name: Create ZIP
shell: pwsh
run: |
$publish = "bin/Release/net10.0/win-x64/publish"
$version = (Select-String -Path "$publish\*.deps.json" -Pattern '"version":').Line.Split('"')[3]
$version = ${{ steps.version.outputs.version-without-v }}
$zip = "splitter-win-x64-$version-${{ github.run_number }}.zip"
if (Test-Path $zip) { Remove-Item $zip }