Skip to content

ci: replace release-PR workflow with canonical PSR push-to-main pattern#39

Merged
ckrough merged 1 commit into
mainfrom
worktree-indexed-munching-scott
May 11, 2026
Merged

ci: replace release-PR workflow with canonical PSR push-to-main pattern#39
ckrough merged 1 commit into
mainfrom
worktree-indexed-munching-scott

Conversation

@ckrough
Copy link
Copy Markdown
Owner

@ckrough ckrough commented May 11, 2026

Replace the two-workflow release-PR pattern with the canonical python-semantic-release shape: one workflow on push: main that lets PSR own version, changelog, tag, GitHub Release, and asset upload in a single action.

Why the current setup is fragile

  1. Two-workflow coordination loop via the sticky chore/release branch and a release label. PSR has no first-class support for release-PR semantics; the workflow is hand-rolled glue around semantic-release version --no-push --no-tag --no-vcs-release --skip-build.
  2. Re-extracts version with grep -m1 '^version = ' in release.yml after merge, duplicating logic PSR already owns.
  3. Release notes come from an awk header-matcher over CHANGELOG.md. The CHANGELOG is currently empty, so the awk script falls through to the "no entry matched" branch and produces effectively nothing.
  4. PSR's GitHub Release machinery is bypassed by --no-vcs-release, then reimplemented by hand with gh release create. The most useful output PSR offers is the one being disabled.
  5. The "human-mergeable" release PR adds coordination cost, not safety. PR-time CI already gates correctness; the release PR is a second click whose only effect is to delay the release.

What this PR changes

Change File
DELETE .github/workflows/release-pr.yml
REPLACE .github/workflows/release.yml (87 lines → 37)
ADD build_command = "uv build" in [tool.semantic_release]

The proposed release.yml is the canonical YAML from the python-semantic-release docs: push-to-main trigger, single release job with contents: write, actions/checkout@v4 + git reset --hard ${{ github.sha }} to release the exact triggering commit, then python-semantic-release@v10.5.3 and (conditionally) publish-action@v10.5.3.

build_command = "uv build" produces sdist and wheel. PSR's upload_to_vcs_release defaults to true, so dist/* attaches to the GH Release automatically.

Local dry-run

Run from this branch with the branch matcher temporarily broadened to .* for verification only; the merged config still pins branch = "main":

$ semantic-release --noop version --print
0.1.0
No release will be made, 0.1.0 has already been released!

$ semantic-release --noop changelog
[NOP] would have written your changelog to CHANGELOG.md

v0.1.0 is an annotated tag at the current main HEAD (2090678), so there are zero commits between the tag and HEAD. After this PR merges, the next conventional-commit landing on main will fire the first real release.

Operator flow after merge

  1. PR opens with Conventional Commit title (already enforced by lint-pr-title.yml)
  2. ci.yml gates correctness
  3. Squash-merge to main
  4. release.yml fires on the push: PSR bumps pyproject.toml, writes CHANGELOG.md, commits, tags, creates GH Release with auto-generated notes, builds and attaches dist/*

No release PR, no second workflow, no awk.

Move from the sticky chore/release branch with hand-rolled tag-and-publish
to the canonical python-semantic-release shape: one workflow on push to
main that lets PSR own version, changelog, tag, GitHub Release, and asset
upload in a single action.

- Delete .github/workflows/release-pr.yml
- Replace .github/workflows/release.yml with the PSR docs' canonical YAML
  (python-semantic-release@v10.5.3 + publish-action@v10.5.3, push: main
  trigger, concurrency group, contents: write only on the release job)
- Add build_command = "uv build" so sdist and wheel attach to the GH
  Release via PSR's upload_to_vcs_release (default true)

Source:
https://python-semantic-release.readthedocs.io/en/stable/configuration/automatic-releases/github-actions.html
@ckrough ckrough merged commit b4d5270 into main May 11, 2026
5 checks passed
@ckrough ckrough deleted the worktree-indexed-munching-scott branch May 11, 2026 12:48
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