chore(release): v1.9.52 #125
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: Package and release | |
| on: | |
| # Publishing is tag-only. Existing releases are refused before marketplace upload. | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| preflight: | |
| # Keep this in sync with the publishing job gate: forced/deleted tag events | |
| # must not run release machinery. | |
| if: ${{ github.event.created == true && github.event.forced == false && github.event.deleted == false }} | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check CI action refs | |
| shell: pwsh | |
| run: .\scripts\report-ci-action-refs.ps1 -EnforcePinnedWorkflowRefs | |
| - name: Check release ancestry | |
| shell: pwsh | |
| run: .\scripts\check-release-ancestry.ps1 -Tag $env:GITHUB_REF_NAME | |
| - name: Install check tools | |
| shell: pwsh | |
| run: .\scripts\install-check-tools.ps1 -Install -EnforceToolLocks | |
| - name: Check release version | |
| shell: pwsh | |
| run: .\scripts\check-release-version.ps1 -Tag $env:GITHUB_REF_NAME -EnforceSemVer | |
| - name: Lua checks | |
| shell: pwsh | |
| run: .\scripts\check-lua.ps1 -Release -ArchonMaxAgeDays 3 -EnforceToolLocks | |
| release: | |
| needs: preflight | |
| # WARNING: BigWigs Packager uploads to public marketplaces and is not | |
| # idempotent there. Re-running an old tag can create duplicate | |
| # CurseForge/Wago/WoWI files even if the GitHub Release already existed. | |
| # A real release is the first creation of a v* tag; history rewrites, | |
| # mirror pushes, and forced tag updates must not publish anything. | |
| if: ${{ github.event.created == true && github.event.forced == false && github.event.deleted == false }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 | |
| with: | |
| fetch-depth: 0 | |
| - name: Refuse existing release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # WARNING: This is a second marketplace safety gate, not a bug. | |
| # If a release for this tag exists, the tag has already been | |
| # packaged at least once. Stop before BigWigs Packager reaches | |
| # CurseForge/Wago/WoWI, where duplicate uploads are visible and | |
| # cleanup requires marketplace-specific manual/API deletion. | |
| if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| echo "::error::Release $GITHUB_REF_NAME already exists; refusing to republish marketplace files." | |
| exit 1 | |
| fi | |
| - name: Trim release changelog | |
| shell: pwsh | |
| run: ./scripts/check-release-version.ps1 -Tag $env:GITHUB_REF_NAME -EnforceSemVer -ExportTopChangelogPath CHANGELOG.md | |
| - name: Check CI action refs | |
| shell: pwsh | |
| run: ./scripts/report-ci-action-refs.ps1 -EnforcePinnedWorkflowRefs | |
| - name: Install release validation tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lua5.1 | |
| - name: Build package without publishing | |
| id: build-package | |
| uses: BigWigsMods/packager@6d50adb6e8517eefef63f4afb16a6518166a6b28 | |
| with: | |
| args: -d | |
| - name: Validate package artifact | |
| shell: pwsh | |
| env: | |
| STATSPRO_ARCHIVE_PATH: ${{ steps.build-package.outputs.archive_path }} | |
| run: | | |
| ./scripts/check-package-dry-run.ps1 ` | |
| -ArchivePath $env:STATSPRO_ARCHIVE_PATH ` | |
| -ExpectedTag $env:GITHUB_REF_NAME ` | |
| -PackageRoot (Join-Path ".release" "StatsPro") ` | |
| -ManifestPath (Join-Path $env:RUNNER_TEMP "statspro-package-tree.before.sha256") ` | |
| -ArchonMaxAgeDays 3 ` | |
| -EnforceToolLocks | |
| - name: Check marketplace versions | |
| shell: pwsh | |
| env: | |
| CF_API_KEY: ${{ secrets.CF_API_KEY }} | |
| run: ./scripts/check-marketplace-versions.ps1 | |
| - name: Rebuild package without publishing | |
| id: rebuild-package | |
| uses: BigWigsMods/packager@6d50adb6e8517eefef63f4afb16a6518166a6b28 | |
| with: | |
| args: -e -d | |
| - name: Compare rebuilt package and validate again | |
| shell: pwsh | |
| env: | |
| STATSPRO_ARCHIVE_PATH: ${{ steps.rebuild-package.outputs.archive_path }} | |
| run: | | |
| ./scripts/check-package-dry-run.ps1 ` | |
| -ArchivePath $env:STATSPRO_ARCHIVE_PATH ` | |
| -ExpectedTag $env:GITHUB_REF_NAME ` | |
| -PackageRoot (Join-Path ".release" "StatsPro") ` | |
| -CompareManifestPath (Join-Path $env:RUNNER_TEMP "statspro-package-tree.before.sha256") ` | |
| -ArchonMaxAgeDays 3 ` | |
| -EnforceToolLocks | |
| - name: Publish package and release | |
| uses: BigWigsMods/packager@6d50adb6e8517eefef63f4afb16a6518166a6b28 | |
| env: | |
| CF_API_KEY: ${{ secrets.CF_API_KEY }} | |
| WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }} | |
| WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }} | |
| GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| args: -c -e -o | |
| - name: Validate published GitHub release assets | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $tag = $env:GITHUB_REF_NAME | |
| $assetDir = Join-Path $env:RUNNER_TEMP "statspro-release-assets" | |
| New-Item -ItemType Directory -Path $assetDir -Force | Out-Null | |
| function Save-ReleaseAsset { | |
| param([string]$Name) | |
| $path = Join-Path $assetDir $Name | |
| for ($attempt = 1; $attempt -le 6; $attempt++) { | |
| $output = @(gh release download $tag --repo $env:GITHUB_REPOSITORY --pattern $Name --dir $assetDir --clobber 2>&1) | |
| if ($LASTEXITCODE -eq 0 -and (Test-Path -LiteralPath $path -PathType Leaf)) { | |
| return $path | |
| } | |
| Write-Host "Release asset $Name not ready on attempt $attempt`: $($output -join ' ')" | |
| if ($attempt -lt 6) { | |
| Start-Sleep -Seconds ([Math]::Min(60, 5 * [Math]::Pow(2, $attempt - 1))) | |
| } | |
| } | |
| throw "Release asset $Name was not downloadable after retries." | |
| } | |
| $zipPath = Save-ReleaseAsset -Name "StatsPro-$tag.zip" | |
| $releaseJsonPath = Save-ReleaseAsset -Name "release.json" | |
| ./scripts/check-release-artifact.ps1 ` | |
| -ZipPath $zipPath ` | |
| -ReleaseJsonPath $releaseJsonPath ` | |
| -ExpectedTag $tag ` | |
| -WithReleaseJson ` | |
| -ArchonMaxAgeDays 3 ` | |
| -EnforceToolLocks |