diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df7c6ea..240e875 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,20 @@ jobs: with: dotnet-version: 8.0.x + # Extract and publish version + - name: extract version + run: | + Get-Content "./src/NomadIIS/PluginInfo.cs" | Select-String 'public static readonly string Version = "([0-9]+\.[0-9]+\.[0-9])";' | ForEach-Object { + $version = $_.Matches[0].Groups[1].Value + } + $version | Out-File -Path version -NoNewline + - name: Upload version + if: ${{ matrix.profile.artifactName == 'nomad_iis' }} # We only need to do this once + uses: actions/upload-artifact@v4 + with: + name: version + path: ./version + # Publish the application - name: Publish the application run: dotnet publish "./src/NomadIIS/NomadIIS.csproj" /p:PublishProfile="./src/NomadIIS/Properties/PublishProfiles/${{ matrix.profile.publishProfile }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 499f87a..bbb667f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,12 @@ jobs: steps: # Download artifacts + - uses: actions/download-artifact@master + with: + name: version + path: version + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.runId }} - uses: actions/download-artifact@master with: name: nomad_iis @@ -29,6 +35,13 @@ jobs: github-token: ${{ github.token }} run-id: ${{ github.event.inputs.runId }} + # Read version + - name: read version + run: | + $version = Get-Content .\version -Raw + Write-Host 'Version: ${version}' + echo "VERSION=${version}" >> $env:GITHUB_ENV + # Zip the artifacts - uses: vimtor/action-zip@v1.2 with: @@ -43,8 +56,8 @@ jobs: - name: create release uses: softprops/action-gh-release@v2 with: - name: vTODO - tag_name: vTODO + name: v${{ env.VERSION }} + tag_name: v${{ env.VERSION }} draft: true files: | nomad_iis.zip