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: on:
push: push:
branches: [ "master" ] tags:
pull_request: - 'v*'
branches: [ "master" ]
jobs: jobs:
build: build:
@ -22,18 +21,22 @@ jobs:
- name: Restore - name: Restore
run: dotnet restore -r win-x64 run: dotnet restore -r win-x64
- name: 'Get Version'
id: version
uses: battila7/get-version-action@v2
- name: Build Release - 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 - 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 - name: Create ZIP
shell: pwsh shell: pwsh
run: | run: |
$publish = "bin/Release/net10.0/win-x64/publish" $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" $zip = "splitter-win-x64-$version-${{ github.run_number }}.zip"
if (Test-Path $zip) { Remove-Item $zip } if (Test-Path $zip) { Remove-Item $zip }