Skip to content

ci: build dist at release time and keep release tags on main - #19

Merged
7nohe merged 4 commits into
mainfrom
fix/release-workflow-commit-dist
Jun 24, 2026
Merged

ci: build dist at release time and keep release tags on main#19
7nohe merged 4 commits into
mainfrom
fix/release-workflow-commit-dist

Conversation

@7nohe

@7nohe 7nohe commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Problem

release-please keeps re-listing already-released commits and over-bumping the version (e.g. the open chore(main): release 0.3.0 PR re-lists every 0.2.0 feature when only one fix: has landed since v0.2.0). The 0.2.0 changelog already shows the same duplication of 0.1.6's entries.

Root cause

The old build-and-tag job built dist/ at release time, committed it as a separate chore: add dist for vX commit created from a detached checkout of the tag, and force-moved the release tag onto that commit. The result: every release tag (v0.1.6, v0.2.0, v0) points to a commit that is not in main's history. release-please anchors its changelog/version on the previous release tag's commit while walking main; since no recent release tag is reachable on main, it re-collects commits all the way back, inflating both the changelog and the bump.

Fix

Keep building the bundle at release time (so it stays out of normal dev PRs), but commit it on top of main and point the tags at that on-main commit:

  • dist/ stays gitignored — contributors never build it or include it in a PR diff.
  • On release (release_created == true), the workflow builds the Action bundle, commits it on top of main, pushes main, then points the release tag and the floating major tag at that commit.
  • Because the tag now lives on main's history, release-please can always detect the previous release boundary on the next run.
  • git pull --rebase guards against a concurrent push to main during the release run.

The previous attempt in this PR (committing dist in dev + a per-PR auto-commit workflow) was reverted in favor of this release-time approach.

Trade-offs

  • Requires the github-actions bot to be able to push to main (the workflow has contents: write). If main enforces a protected-branch rule that blocks bot pushes, that rule must allow it.
  • main between releases has no committed bundle; only release tags carry one. uses: ...@vX (tags) always resolves a ready-to-run build; uses: ...@main does not.

Follow-up (not in this PR — needs owner decision)

The existing v0.2.0 tag is still off main, so the next release-please PR may mis-walk once. Re-pointing v0.2.0 to its real release commit would force-push a published tag (and drop dist from @v0.2.0), so it is intentionally left out. From the first release tagged under this workflow onward, boundaries are correct automatically — the simplest path is to manually correct that one transitional release PR to the expected version (0.2.1) before merging.

7nohe added 3 commits June 24, 2026 17:20
The release workflow built dist/ at release time and force-moved the
release tag (e.g. v0.2.0) onto a separate "chore: add dist" commit that
is not part of main's history. release-please anchors its changelog on
the previous release tag's commit, so once the tag pointed off main it
could no longer detect the release boundary and re-collected
already-released commits on every run (e.g. the 0.3.0 PR re-listed every
0.2.0 feature and bumped minor instead of patch).

Commit the Action bundle (dist/index.js and its runtime companions) to
main instead, matching the model already documented in DEVELOPMENT.md
and enforced by the CI dist freshness check. The release tag now stays
on the main release commit, and the workflow only moves the floating
major-version tag. dist/cli/ and type declarations remain untracked
(built on demand and at npm publish).
Collapse dist/index.js (and its map/sourcemap-register companions) in
GitHub diffs and exclude them from language statistics, since they are
generated build artifacts committed only so the Action runs via uses:@vx.
Rebuild the committed Action bundle in CI and push it back to the PR
branch so contributors never have to run 'npm run build' locally. Fork
PRs (read-only token) fall back to a verify-only job that fails if the
bundle is stale. Drop the now-redundant dist freshness check from the
main CI workflow.
@7nohe 7nohe changed the title ci: commit Action bundle and stop moving release tags off main ci: build dist at release time and keep release tags on main Jun 24, 2026
Switch to building the Action bundle during the release run rather than
committing it to the repository on every change:

- dist/ is gitignored again; contributors never build it or carry it in
  a PR diff.
- On release, the workflow builds the bundle, commits it on top of main,
  and points the release tag (and the major tag) at that commit. The tag
  stays on main's history, so release-please keeps detecting the previous
  release boundary correctly.

This reverts the dev-time dist commit and the per-PR auto-commit
workflow in favor of the release-time approach. The .gitattributes
entries marking the bundle as generated are kept, so the bundle the
release workflow commits stays collapsed in diffs and out of language
stats.
@7nohe
7nohe force-pushed the fix/release-workflow-commit-dist branch from 3dfb38c to 939ab5e Compare June 24, 2026 08:53
@7nohe
7nohe merged commit 76aef9c into main Jun 24, 2026
4 checks passed
@7nohe
7nohe deleted the fix/release-workflow-commit-dist branch June 24, 2026 08:55
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