Skip to content

ci: build the Action bundle into the release PR (fix broken v0.2.1)#20

Merged
7nohe merged 1 commit into
mainfrom
fix/release-pr-dist
Jun 24, 2026
Merged

ci: build the Action bundle into the release PR (fix broken v0.2.1)#20
7nohe merged 1 commit into
mainfrom
fix/release-pr-dist

Conversation

@7nohe

@7nohe 7nohe commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Background

main is protected by a ruleset: changes must be made through a pull request (and no force-push). The previous release workflow tried to build dist/ and push it directly to main at release time — GitHub rejected it (GH013), so the v0.2.1 release tag has no bundle and uses: 7nohe/[email protected] is currently broken (npm 0.2.1 published fine).

Approach

Build the Action bundle into the open release PR, not onto main directly:

  • release.yml's release-please job exposes its pr output. A new build-release-pr-dist job runs in the same workflow run (triggered by the human merge that updates main), checks out the release PR branch, rebuilds dist/, and commits it back to that branch. Pushing to the release PR's own branch is allowed because protection only covers main. No PAT or ruleset change needed.
  • When the release PR is merged, its release commit already carries an up-to-date dist/, so the release tag (which stays on main) is immediately runnable via uses:@vX.
  • tag-major-version moves the floating v0 tag to the release commit.
  • Feature PRs never touch dist/ — only the release PR does.

The bundle is tracked again (dist/index.js + map/sourcemap-register/licenses); dist/cli/ and type declarations stay ignored.

Why not the alternatives

  • Push dist to main at release → blocked by the PR-only rule (this is the bug being fixed).
  • Auto-commit dist on every feature PR → works, but adds a bot dist commit to each PR; this keeps feature PRs clean instead.

After merge (manual, one-time)

v0.2.1 is already tagged without a bundle. Once this merges, the v0.2.1 and v0 tags will be re-pointed to the merge commit (which carries the bundle built from the unchanged 0.2.1 source) so the Action works at v0.2.1. From the next release onward this is automatic.

main is protected (changes must go through a pull request), so the bot
cannot push dist to main at release time — the previous release-time
push was rejected (GH013) and left v0.2.1 tagged without a bundle.

Instead, build the bundle into the open release PR during the same
release.yml run that release-please updates it (pushing to the release
PR's own branch, which protection does not cover). The release commit
then already carries an up-to-date dist/ when merged, so the release tag
is immediately runnable via uses:@vx, while feature PRs stay free of
dist/ churn. The major tag is moved to the release commit on release.

Track the bundle again (dist/index.js and runtime companions); the
release workflow keeps it fresh.
@7nohe 7nohe merged commit d707bfb into main Jun 24, 2026
4 checks passed
@7nohe 7nohe deleted the fix/release-pr-dist branch June 24, 2026 09:10
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