Release #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag, for example v0.4.0" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} | |
| - name: Build release archive | |
| id: build | |
| shell: pwsh | |
| run: | | |
| $archivePath = pwsh -File ./scripts/build-release.ps1 | |
| if (-not $archivePath) { | |
| throw "build-release.ps1 did not return an archive path" | |
| } | |
| "archive_path=$archivePath" >> $env:GITHUB_OUTPUT | |
| - name: Build release notes | |
| id: notes | |
| shell: pwsh | |
| env: | |
| RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | |
| run: | | |
| $version = $env:RELEASE_TAG -replace '^v', '' | |
| $notesPath = Join-Path $env:RUNNER_TEMP ("steam-promo-watch-{0}-release-notes.md" -f $version) | |
| pwsh -File ./scripts/get-release-notes.ps1 -Version $version -OutputPath $notesPath | |
| "notes_path=$notesPath" >> $env:GITHUB_OUTPUT | |
| - name: Create or update GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | |
| shell: pwsh | |
| run: | | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = 'Stop' | |
| $tag = $env:RELEASE_TAG | |
| $archivePath = "${{ steps.build.outputs.archive_path }}" | |
| $notesPath = "${{ steps.notes.outputs.notes_path }}" | |
| $PSNativeCommandUseErrorActionPreference = $false | |
| gh release view $tag *> $null | |
| $releaseViewExitCode = $LASTEXITCODE | |
| $PSNativeCommandUseErrorActionPreference = $true | |
| if ($releaseViewExitCode -eq 0) { | |
| gh release upload $tag $archivePath --clobber | |
| gh release edit $tag --title "Steam Promo Watch $tag" --notes-file $notesPath --latest | |
| } elseif ($releaseViewExitCode -eq 1) { | |
| gh release create $tag $archivePath --title "Steam Promo Watch $tag" --notes-file $notesPath --latest --verify-tag | |
| } else { | |
| throw "gh release view failed with exit code $releaseViewExitCode" | |
| } |