diff --git a/.codex/scripts/prerelease-notes.sh b/.codex/scripts/prerelease-notes.sh index 0de5ddf..1acc09d 100644 --- a/.codex/scripts/prerelease-notes.sh +++ b/.codex/scripts/prerelease-notes.sh @@ -90,6 +90,10 @@ if [ ! -f "$CHANGELOG_PATH" ]; then fail "Unable to locate changelog at '$CHANGELOG_PATH'." fi +if ! grep -Eq '^##[[:space:]]*Unreleased[[:space:]]*$' "$CHANGELOG_PATH"; then + fail "CHANGELOG.md must contain a ## Unreleased section before creating or publishing a prerelease." +fi + unreleased_body=$( awk ' /^##[[:space:]]*Unreleased[[:space:]]*$/ { in_unreleased = 1; next } @@ -143,21 +147,18 @@ cat > "$OUTPUT_PATH" < [!NOTE] > This GitHub pre-release is the source artifact for the matching Thunderstore publish. Thunderstore receives package version \`${VERSION}\` from tag \`${TAG}\`. -
-Good to know before Thunderstore +### 📦 Thunderstore handoff -| Item | Detail | +| Signal | Detail | | --- | --- | -| Changelog turnover | \`## Unreleased\` is empty; notes below come from \`${VERSION}\`. | -| Source branch | \`${BRANCH}\` | -| Source commit | \`${short_commit}\` | -| Workflow run | ${run_detail} | -| GitHub tag | \`${TAG}\` | -| Thunderstore version | \`${VERSION}\` | - -
- -### Changes +| 📝 Changelog | \`## Unreleased\` is empty; notes below come from \`${VERSION}\`. | +| 🌿 Branch | \`${BRANCH}\` | +| 🔖 Commit | \`${short_commit}\` | +| ▶️ Run | ${run_detail} | +| 🏷️ Tag | \`${TAG}\` | +| 📦 Package | \`${VERSION}\` | + +### ✨ Changes ${version_body} EOF diff --git a/.codex/scripts/prerelease-notes.tests.ps1 b/.codex/scripts/prerelease-notes.tests.ps1 index 1e31df3..9d75f88 100644 --- a/.codex/scripts/prerelease-notes.tests.ps1 +++ b/.codex/scripts/prerelease-notes.tests.ps1 @@ -68,10 +68,19 @@ function Test-PrereleaseNotesIncludesChangelogAndDetailsCard { } $Notes = Get-Content -Raw -Path $OutputPath - Assert-Match -Text $Notes -Pattern '
' -Message "Release notes did not include the details card." - Assert-Match -Text $Notes -Pattern 'Good to know before Thunderstore' -Message "Release notes did not include the card summary." + if ($Notes -match '> "$GITHUB_ENV" echo "ALLOWED_PACKAGE_VERSION_PATTERN=$allowed_package_version_pattern" >> "$GITHUB_ENV" + - name: Preserve release helper scripts + shell: bash + run: | + cp .codex/scripts/prerelease-notes.sh "$RUNNER_TEMP/prerelease-notes.sh" + chmod +x "$RUNNER_TEMP/prerelease-notes.sh" + - name: Download Release run: gh release download "$RELEASE_TAG" -D ./dist env: @@ -83,7 +89,7 @@ jobs: - name: Validate downloaded release changelog shell: bash run: | - bash .codex/scripts/prerelease-notes.sh \ + bash "$RUNNER_TEMP/prerelease-notes.sh" \ --changelog ./dist/CHANGELOG.md \ --version "$PACKAGE_VERSION" \ --tag "$RELEASE_TAG" \