Skip to content

fix(release): harden tag-based publish workflow and document process - #62

Merged
shaonianche merged 2 commits into
mainfrom
agent/code-expert/d3ea47a8
Aug 5, 2026
Merged

fix(release): harden tag-based publish workflow and document process#62
shaonianche merged 2 commits into
mainfrom
agent/code-expert/d3ea47a8

Conversation

@shaonianche

Copy link
Copy Markdown
Owner

Summary

Implements the SHA-36 P0/P1 release-process fixes discussed on the Multica issue (no version bump, no publish).

Workflow (.github/workflows/publish.yml)

  • Trigger only on v* tags (removed catch-all tags and workflow_dispatch)
  • Correct prerelease detection for vX.Y.Z stable vs PEP 440-style prereleases (v0.9.16a1, …)
  • Hard gate: tag version (without v) must equal pyproject.toml [project].version
  • After uv build, assert wheel/sdist version matches the tag
  • Extract the matching ## Release vX.Y.Z section (keep header); fail if missing/empty
  • Create GitHub Release with explicit tag_name and correct prerelease flag

Docs

  • New docs/RELEASING.md maintainer checklist
  • Links from AGENTS.md and README.md
  • Towncrier fragment news/SHA-36.doc

Package version remains 0.9.15. This PR does not push tags or publish to PyPI.

Test plan

  • Local simulation: tag v0.9.15 matches pyproject version; bare 0.9.15 rejected
  • Changelog extraction for 0.9.15 returns the expected section with header
  • Prerelease tag pattern parses v0.9.16a1
  • CI green on this PR
  • After merge: next real release follows docs/RELEASING.md (separate bump + tag)

Align Release CI with vX.Y.Z tags: gate tag against pyproject version,
require a matching CHANGELOG section, and add a maintainer release
checklist without bumping the package version.

Co-authored-by: multica-agent <github@multica.ai>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ee9cb7ba7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +112
- name: Extract changelog for this version
run: |
awk '/## Release/{if (flag==1)exit;else;flag=1;next} flag' CHANGELOG.md > .changelog.md
set -euo pipefail

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate changelog before publishing to PyPI

When a maintainer tags a matching version but forgets to build the Towncrier section, the missing/empty changelog checks in this step fail only after pypa/gh-action-pypi-publish has already uploaded immutable files. That leaves a partial release and a normal rerun will hit PyPI's duplicate version/file rejection, so the changelog extraction and validation need to run before the PyPI publish step.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/publish.yml Outdated
Comment on lines +115 to +117
awk -v ver="$TAG_VERSION" '
BEGIN { hdr = "## Release v" ver }
index($0, hdr) == 1 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match the changelog header exactly

When the tag version is a prefix of another release header, such as v0.9.1 with an existing ## Release v0.9.15 section or stable v0.10.0 with only v0.10.0a1, this prefix match selects the wrong section and the later grep check also passes. That can create a GitHub Release with another version's notes; require the header to match the version boundary, e.g. the following space/date separator, instead of any prefix.

Useful? React with 👍 / 👎.

Comment thread news/SHA-36.doc
@@ -0,0 +1 @@
Document the release checklist and harden the tag-based PyPI/GitHub Release workflow (version gate, ``v``-prefix tags, changelog extraction).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a numeric Towncrier fragment id

This fragment is named SHA-36.doc, but the repository's Towncrier guidance expects an issue number; with the configured GitHub issue URL format, building the changelog will render a #SHA-36 link to /issues/SHA-36 rather than a valid numeric issue. Please rename the fragment to the corresponding numeric issue id, or change the configured linking scheme first.

AGENTS.md reference: AGENTS.md:L129-L137

Useful? React with 👍 / 👎.

Validate the matching CHANGELOG section before PyPI publish, and match
release headers on a version boundary so shorter prefixes cannot select
another release's notes.

Co-authored-by: multica-agent <github@multica.ai>
@shaonianche

Copy link
Copy Markdown
Owner Author

Addressed Codex review feedback:

  1. P1 — Moved changelog extraction/validation before Publish to PyPI, so a missing Towncrier section fails without uploading immutable files.
  2. P2 — Changelog headers must match ## Release v{version} … with a trailing space after the version (Towncrier date form), so v0.9.1 cannot select v0.9.15.
  3. P2 (news/SHA-36.doc) — Left as-is. The tree already uses Multica-style ids (SHA-10SHA-23, etc.); renaming only this fragment would not fix the broader Towncrier→GitHub issue link pattern. Track separately if we want numeric GitHub issue ids only.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e42c3910c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

echo "Run: uv run towncrier build --version ${TAG_VERSION}" >&2
exit 1
fi
if [[ ! -s .changelog.md ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check changelog content after the header

The fresh issue is that this new -s check counts the extracted header itself as content; when CHANGELOG.md contains the matching ## Release header but no release-note lines (for example a manually added header or otherwise empty release section), .changelog.md is still non-empty, so the workflow can publish to PyPI and create a GitHub Release with no user-facing notes. Validate that there is content after the header instead of checking only file size.

AGENTS.md reference: AGENTS.md:L129-L139

Useful? React with 👍 / 👎.

@shaonianche
shaonianche merged commit 10daab3 into main Aug 5, 2026
7 checks passed
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (93b6e0a) to head (9e42c39).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #62   +/-   ##
=======================================
  Coverage   92.72%   92.72%           
=======================================
  Files          36       36           
  Lines        2721     2721           
  Branches      461      461           
=======================================
  Hits         2523     2523           
  Misses        117      117           
  Partials       81       81           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant