Skip to content

Auto-create GitHub Release on tag push#6

Merged
mstorath merged 1 commit into
mainfrom
claude/auto-github-release-2026-05
May 8, 2026
Merged

Auto-create GitHub Release on tag push#6
mstorath merged 1 commit into
mainfrom
claude/auto-github-release-2026-05

Conversation

@mstorath
Copy link
Copy Markdown
Owner

@mstorath mstorath commented May 8, 2026

Summary

Pushing a v* tag publishes to PyPI but does not create an entry on the GitHub Releases page. This PR closes that gap: the publish job in release.yml now also creates a GitHub Release, with the matching ## <version> section of CHANGELOG.md as the body and all wheels + sdist attached as assets.

Identical pattern to:

How it works

In the existing publish job, after the PyPI upload:

  1. actions/checkout@v4 puts CHANGELOG.md on disk.
  2. An awk one-liner extracts the ## <ver> section verbatim — bracket-tolerant so it accepts both ## [1.0.1] - date and ## 1.0.1 — date. Falls back to a tag-commits link if nothing matches.
  3. softprops/action-gh-release@v2 creates the Release with that as the body, attaches dist/*, and stacks generate_release_notes: true on top for an auto-generated PR/commit summary.

Job-level permissions block added (replaces top-level inherit): id-token: write for OIDC + contents: write for the release action.

Idempotent: updates in place if a Release for the tag already exists.

Test plan

  • Awk extraction tested against current CHANGELOG.md locally — the ## [1.0.1] heading matches.
  • First real exercise: next v* tag push.
  • No effect on the build/sdist/publish-to-PyPI jobs themselves.

Tag-push currently uploads to PyPI but does not create a GitHub
Release entry — the Releases page on github.com/mstorath/CSSD stays
out of sync with PyPI. This step closes that gap by extracting the
matching `## <version>` section from CHANGELOG.md (bracket-tolerant,
accepts `## [1.0.1]` and `## 1.0.1`) and posting it to GitHub
Releases via softprops/action-gh-release@v2, with all wheels and the
sdist attached as assets.

Implementation:
- Job-level `permissions` block added (replaces top-level inherit).
  Keeps `id-token: write` for OIDC; adds `contents: write` for the
  release step.
- `actions/checkout@v4` added so CHANGELOG.md is on disk.
- An awk extractor; falls back to a tag-commits link if no matching
  heading or no CHANGELOG.md.
- `generate_release_notes: true` appends an auto-generated PR/commit
  summary on top of the changelog body.
- Idempotent: updates an existing Release for the tag rather than
  erroring, so manual pre-creation never blocks a re-run.

See devcontainer reports/12-auto-github-release-pattern.md for the
shared pattern and the rationale.
@mstorath mstorath merged commit 0c4a5b5 into main May 8, 2026
9 checks passed
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