Skip to content

fix(release-please): attach assets to a draft, then publish it, for immutable releases - #23

Merged
kristoflemmens merged 3 commits into
mainfrom
fix/draft-first
Nov 17, 2026
Merged

kristoflemmens merged 3 commits into
mainfrom
fix/draft-first

Conversation

@kristoflemmens

@kristoflemmens kristoflemmens commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

ha-peak-basket has immutable releases turned on. Its first release candidate with release assets, v0.2.0-rc.1, got its pre-release, but no zip. Upload release assets failed three times with:

HTTP 422: Cannot upload assets to an immutable release.

This workflow publishes the release first and attaches the assets afterwards, and GitHub refuses that once a release is immutable. Release-please's own releases have the same problem: release-please publishes the release before the assets job runs.

What

A release with assets is now a draft until its assets are attached.

  • Release candidate: the job creates its pre-release with --draft when assets is set. Without assets nothing changes.
  • Publish release is a new job. It runs only when this workflow attached assets, and only after a successful upload. If the release is still a draft, it publishes it. Without assets it does not run, so a caller that attaches files of its own in a later job keeps its draft and publishes it itself (from the review).
    • A non-prerelease becomes "Latest" only if it is the highest version. A maintenance branch's v1.4.1 after v2.0.0 gets --latest=false, the same rule as the existing maintenance-branch step.
    • A draft whose assets failed stays a draft, so it never goes out without its files. Fix the cause, then re-run the failed jobs.
  • release-please's releases: the caller's release-please-config.json sets "draft": true and "force-tag-creation": true. GitHub only tags a draft when it is published, and release-please needs the tag to find the previous release. The README and the header of the workflow describe this.
  • Upload release assets: when it fails on a release that is already published, the error now says which config the caller is missing.

gh release view/upload/edit <tag> finds drafts too: FetchRelease in cli/cli looks up drafts next to published releases.

No caller has to change anything, except one with assets and immutable releases whose releases come from release-please. That caller adds the two config keys.

Checks

  • actionlint 1.7.12: clean.
  • zizmor 1.32.0, online, with .github/zizmor.yml: no findings.
  • The scripts of Publish release and Release candidate ran against a fake gh in five cases:
    • already published: left alone;
    • draft rc: published;
    • draft v0.2.0 after v0.1.0: --latest;
    • draft v1.4.1 after v2.0.0: --latest=false;
    • first release: --latest.
      For the rc, with assets it gets --draft and without assets it doesn't.
  • Not run for real yet. The first real run is ha-peak-basket's v0.2.0-rc.2, once its caller pins the release that contains this.

🤖 Generated with Claude Code

…mmutable releases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/release-please.yml Resolved
@claude

claude Bot commented Nov 17, 2026

Copy link
Copy Markdown

Scope full (first review): 2 files read, 1 finding; rules: AGENTS.md, README.md

What this review covered
  • Files read in full: .github/workflows/release-please.yml; README.md (the PR version, from the head rules copy).
  • Files skipped: none.
  • Rules that applied:
    • README.md "Changing a workflow here": actions pinned to a full commit SHA with the version in a comment (the new publish job pins create-github-app-token the same way as the other jobs), and minimal permissions (permissions: {}, it acts as the app). Both are met.
    • README.md "Release": the behaviour described there was checked against the workflow.
    • AGENTS.md has only issue-tracker, triage-label and glossary pointers, none of which applies to this change.
    • I did not run actionlint, zizmor or shellcheck.
  • Rules files this PR changes: README.md, judged by its base version.
  • Findings not posted inline: none.

…attached

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread README.md Resolved
@claude

claude Bot commented Nov 17, 2026

Copy link
Copy Markdown

Scope e67105c..3e5b39f: 2 files read, 1 finding; rules: AGENTS.md, README.md

What this review covered
  • Files read (in full, at the head): .github/workflows/release-please.yml, README.md (the PR version, from head-rules).
  • Files skipped: none.
  • Rules that applied:
    • README.md "Changing a workflow here": actions pinned to a full SHA, minimal permissions. The changed publish job keeps permissions: {} and adds no actions.
    • README.md "Maintenance branches": a maintenance release does not take "Latest" from a higher version. The README text this PR adds tells callers to run gh release edit "$TAG" --draft=false, which would break that guarantee (inline comment on README.md:259-262).
    • AGENTS.md: covers the issue tracker, triage labels and domain docs only; none of it applies to this change.
  • Logic check: the new publish condition (inputs.assets != '' && needs.upload.result == 'success') gates releases the same way as before when assets are set, because upload needs assets, and assets already requires a created release or a successful release candidate. Dropping release-candidate from needs does not affect TAG (tag_name || github.ref_name).
  • Rules files this PR changes: README.md, judged by the base version.
  • Findings that could not be posted inline: none.

…atest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Nov 17, 2026

Copy link
Copy Markdown

Scope 3e5b39f..b4653a9: 1 files read, 0 findings; rules: AGENTS.md, README.md

What this review covered
  • Files read: README.md (PR version, in full); .github/workflows/release-please.yml searched to check the new text against the Publish release job (its sort -V check and --latest=false match the description).
  • Files skipped: none.
  • Rules that applied: AGENTS.md (issue tracker, triage labels, domain docs; none of these concern a README wording change); README.md (base version, "Changing a workflow here": documentation of release-please.yml behaviour).
  • Rules files this PR changes: README.md, judged by the base version.
  • Findings that could not be posted inline: none.

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