diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6b2592f0..efd7c8c49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,11 +53,29 @@ jobs: - name: Extract release notes from CHANGELOG.md run: | VERSION=$(node -p "require('./package.json').version") + # Second stage: unwrap hard-wrapped lines. CHANGELOG.md is wrapped for + # the repo view, but GitHub renders release bodies like comments — a + # single newline becomes
— so wrapped source shows as narrow + # ragged lines. Joins indented continuation lines into their bullet + # and consecutive "> " lines into one; fenced code blocks and nested + # bullets pass through untouched. awk -v ver="$VERSION" ' index($0, "## [" ver "]") == 1 { flag = 1; next } /^## / { flag = 0 } flag - ' CHANGELOG.md > release-notes.md + ' CHANGELOG.md | awk ' + function flush() { if (have) { print buf; have = 0 } } + /^```/ { flush(); print; infence = !infence; next } + infence { print; next } + /^ {2,}[^ ]/ && have && $0 !~ /^ +[-*] / { + line = $0; sub(/^ +/, "", line); buf = buf " " line; next + } + /^> [^ ]/ && have && buf ~ /^> / { + line = $0; sub(/^> /, "", line); buf = buf " " line; next + } + { flush(); buf = $0; have = 1 } + END { flush() } + ' > release-notes.md if ! grep -q '[^[:space:]]' release-notes.md; then echo "::error::CHANGELOG.md has no \"## [$VERSION]\" section — add the curated entry (see CONTRIBUTING.md \"Releases\") and re-tag." exit 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9929db00d..31d1be0a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -213,7 +213,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial version of the QuantEcon MyST theme: Remix + `@myst-theme` book theme with QuantEcon branding, toolbar (home, search, fullscreen, font scaling, dark mode, downloads, Colab/JupyterHub launch, edit-on-GitHub), content-driven site footer, and bundled brand assets. -[Unreleased]: https://github.com/QuantEcon/quantecon-theme.mystmd/compare/v2.2.0...HEAD +[Unreleased]: https://github.com/QuantEcon/quantecon-theme.mystmd/compare/v2.3.0...HEAD [2.3.0]: https://github.com/QuantEcon/quantecon-theme.mystmd/compare/v2.2.0...v2.3.0 [2.2.0]: https://github.com/QuantEcon/quantecon-theme.mystmd/compare/v2.1.0...v2.2.0 [2.1.0]: https://github.com/QuantEcon/quantecon-theme.mystmd/compare/v2.0.0...v2.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 343ad20da..cdb1620d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,7 +93,10 @@ with a link to the PR. To cut a release: 1. In `CHANGELOG.md`, move the `## [Unreleased]` entries under a new `## [X.Y.Z] - YYYY-MM-DD` - heading and add the footer compare link. + heading, add the footer compare link, and re-point the `[Unreleased]` compare link's base + at the new tag (`compare/vX.Y.Z...HEAD`). + Wrapping the entry text is fine — the release workflow unwraps it, because GitHub renders + release bodies (unlike committed Markdown) with single newlines as line breaks. 2. Bump the version in `package.json` (e.g. `npm version X.Y.Z --no-git-tag-version`). You do **not** need to bump `template.yml` — the release workflow stamps its `version` from `package.json` into the published bundle, so the two cannot drift.