Skip to content

ci: attach constraints via draft-then-publish under immutable releases#519

Open
ian-flores wants to merge 2 commits into
mainfrom
fix-immutable-release-constraints
Open

ci: attach constraints via draft-then-publish under immutable releases#519
ian-flores wants to merge 2 commits into
mainfrom
fix-immutable-release-constraints

Conversation

@ian-flores

Copy link
Copy Markdown
Collaborator

Problem

The Publish to PyPI workflow's constraints job fails on every release with:

HTTP 422: Cannot upload assets to an immutable release.

GitHub's Immutable Releases feature is enabled on this repo, so a release's assets are locked the instant it is published. semantic-release created the release (published, not draft) in release.yml, then publish.yml tried to gh release upload the constraints-<version>.txt afterward — which is impossible for an immutable release. The retry loop's "release not ready" assumption no longer holds; 422 is permanent, so all 5 attempts fail.

PyPI publishing itself was unaffected.

Fix

Move GitHub release creation into the tag-triggered publish.yml and use the only flow immutable releases support: create as draft → attach the constraints file → publish.

  • release.yml: --vcs-release--no-vcs-release. semantic-release still bumps the version, writes the changelog, and pushes the tag; it no longer creates the GitHub release.
  • publish.yml: the renamed release job creates the release as a draft with the constraints file attached, then un-drafts it (which locks it immutably, now with the asset baked in). Release notes are reproduced from the CHANGELOG.md section plus the compare-link footer, matching the previous --vcs-release body.

The old tag/release race the retry loop guarded against is gone: nothing creates the release until this job does, after the tag exists.

Notes

  • Fix applies to future releases only. v0.56.0 is already published and immutable with no constraints asset; it cannot be amended retroactively.
  • No change to the README-documented download URL or to the PyPI publish job.

Copilot AI review requested due to automatic review settings July 21, 2026 22:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the release/publish workflow split to work with GitHub Immutable Releases by ensuring the constraints asset is attached before a release is published (and thus locked).

Changes:

  • Stop release.yml (semantic-release) from creating a GitHub Release (--no-vcs-release), while still tagging and updating CHANGELOG.md.
  • Create the GitHub Release in publish.yml as a draft, attach constraints-<version>.txt, then publish the release.
  • Reconstruct release notes from the matching CHANGELOG.md section plus a compare-link footer.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/release.yml Prevents semantic-release from creating/publishing the GitHub Release so assets can be attached before immutability locks it.
.github/workflows/publish.yml Creates a draft release, attaches the constraints file, builds release notes from CHANGELOG.md, then publishes the release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/publish.yml Outdated
Comment on lines +79 to +83
gh release create "${GITHUB_REF_NAME}" "constraints-${VERSION}.txt" \
--draft \
--title "${GITHUB_REF_NAME}" \
--notes-file release-notes.md
gh release edit "${GITHUB_REF_NAME}" --draft=false
Comment on lines +59 to +63
awk -v tag="v${VERSION}" '
$0 ~ "^## " tag "( |$)" {found=1; next}
found && /^## v/ {exit}
found {print}
' CHANGELOG.md > release-notes.md
@ian-flores
ian-flores marked this pull request as ready for review July 21, 2026 22:58
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.

2 participants