From d46dda1271b38291ab7afccec91f1ff2efb82775 Mon Sep 17 00:00:00 2001 From: unclshura Date: Sat, 16 May 2026 21:00:27 +0100 Subject: [PATCH] Get version from the release tag --- .github/workflows/publish.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e223c8d..0e0eef1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }