Skip to content

fix(release): follow the commits when --bump is not given - #8

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/36-look-into-https-github-com-hyperstructur
Oct 18, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/36-look-into-https-github-com-hyperstructur

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

node scripts/release.mjs --dry-run, the preview that AGENTS.md and the release skill give, now reports the version the Release workflow would make. The script took the argument after --bump as the bump, so without --bump it took the first argument: --dry-run became the bump, and nextVersion() treats anything that isn't major or minor as a patch. With #6 (a feat) since v0.3.0:

$ node scripts/release.mjs --dry-run    # main
@hyperstructure/design 0.3.1 (--dry-run bump since v0.3.0)

$ node scripts/release.mjs --dry-run    # this branch
@hyperstructure/design 0.4.0 (minor bump since v0.3.0)

releaseOptions() reads the arguments now, with node:util's parseArgs. It is in scripts/commits.mjs, next to bumpOf() and nextVersion(), so npm test covers it without running a release.

  • Without --bump, the bump is auto: the commits pick it.
  • --bump takes auto, patch, minor or major, as --bump minor or --bump=minor, before or after --dry-run.
  • Anything else stops the script with exit code 2 and the usage: an unknown option, a stray argument, or a missing or unknown bump. Before, a bare --bump meant auto, and other arguments were ignored or, when first, taken as a patch: on main, a mistyped --dryrun commits and tags v0.3.1 locally instead of previewing.

fctl's cargo xtask release already defaults to auto and rejects arguments it doesn't know. Releases from the workflow don't change, since it always passes --bump "$BUMP" (with --dry-run for a dry run). Tooling only: nothing in the package changes.

Verification

  • npm run check, npm test (7 tests; the new one is "release options") and npm run build.
  • The new test fails on the old argument handling, at --dry-run: bump is '--dry-run' where 'auto' is expected.
  • On this branch, --dry-run and --bump auto --dry-run print the same preview (0.4.0), --bump patch --dry-run previews 0.3.1, and --bump, --bump huge, --dryrun and minor exit with code 2 without changing anything.
  • In a throwaway local clone of this branch, node scripts/release.mjs with no arguments wrote 0.4.0 to package.json, package-lock.json and CHANGELOG.md, and committed and tagged v0.4.0. A clone of main given --dryrun committed and tagged v0.3.1.

Fixes #7

Session: https://app.fctl.sh/s/ses_01M57KT5CM8S7DMP21YJMN6JCK

scripts/release.mjs took the argument after `--bump` as the bump, so
without `--bump` it took the first argument: `--dry-run` previewed a
patch whatever the commits called for. The options are now parsed by
`releaseOptions()` in scripts/commits.mjs with node:util's parseArgs:
the bump is auto unless given, and an unknown option, a stray argument
or a missing or unknown bump stops the script.

Refs #7
@kalaspuff
kalaspuff merged commit 1a25680 into main Oct 18, 2026
2 checks passed
@kalaspuff
kalaspuff deleted the fctl/36-look-into-https-github-com-hyperstructur branch October 18, 2026 13:47
kalaspuff pushed a commit that referenced this pull request Oct 18, 2026
The Release workflow now also runs after every merge to `main`, and
releases when the commits since the last tag include a `feat`, `fix`,
`perf`, `revert` or breaking change. Other changes (`docs`, `refactor`,
`test`, `build`, `ci`, `chore`) wait for the next release. Running it by
hand works as before: it releases whatever is new, with any bump, or
does a dry run.

This automates what has been done by hand so far: each feature was
released by hand within minutes of merging (#4 → v0.2.0, #5 → v0.3.0, #6
and #8 → v0.4.0), while #1–#3 (`ci`, `ci`, `docs`) waited and went out
with v0.2.0. It is also semantic-release's default rule. Consumers pin
exact tags, so a release changes nothing for fctl or fctl.sh until they
move their pin.

## How

- **`scripts/release.mjs --if-due`**: releases only when `releaseDue()`
says the changes call for it. Otherwise it prints `No release: no feat,
fix, perf, revert or breaking change since vX.Y.Z.`, adds that to the
job summary, and exits 0. The workflow passes it for merges (`push` to
`main`), not for runs by hand.
- **The workflow** checks out `main` as it is when the run starts, not
the commit that started it, so a run that waited behind another one sees
that one's release and finds nothing to do. Runs are already queued one
at a time (`concurrency: release`). If a merge lands while a run is
releasing, the atomic push of the commit and tag is rejected. A run
after a merge then leaves the release to the newer merge's run (a
notice, exit 0) instead of failing. Any other rejected push still fails.
- **`releaseOptions()` moves from `scripts/commits.mjs` to
`scripts/release.mjs`**, which exports it with `releaseDue()` and
releases only when run as a script, as `icons.mjs` does.
hyperstructure/fctl-site copies `commits.mjs` and its test and is told
to keep them in step. #8 added a function there that only this script
uses, so the copies had drifted. Both files are now the same as
fctl-site's again, and the tests are in `scripts/release.test.mjs`. The
check for being run as a script compares real paths, because through a
symlink `argv[1]` and `import.meta.url` differ and a release script must
not silently do nothing.
- **Docs**: README.md's release section said to bump the version and
push a tag by hand, which the workflow has done since #1. It, AGENTS.md
and the `release`, `commit` and `pull-requests` skills now say which
merges release, how to release the rest by hand, and how to find the
release a merge made (`gh run list --workflow release.yml --commit
MERGE_SHA`, then `git tag --contains`). The commit skill's type table
says when each type is released.

Merging this releases nothing: since v0.4.0 there are only this pull
request's `refactor`, `ci` and `docs` commits.

fctl's and fctl-site's AGENTS.md say to change design, "tag a release",
then bump the tag. That stays true: a merge now makes the tag.

## Verification

- `npm run check`, `npm test` (8 tests: "release options", and "a merge
releases features, fixes, reverts and breaking changes") and `npm run
build`.
- `node scripts/release.mjs` still runs by relative path, absolute path
and through a symlinked directory, and importing it in the tests
releases nothing.
- The release step's shell, extracted from the workflow, run against a
local bare repository standing in for GitHub, with a stub `gh` that
records its arguments:

| Case | Result |
|---|---|
| This pull request merges | No release, exit 0 |
| A `feat` merges | v0.5.0: commit and tag pushed, `gh release create
v0.5.0 … --notes-file …` |
| A run that waited behind that release | No release, exit 0 |
| A `docs` merge | No release, exit 0 |
| A `fix` merges, and a `feat` lands during its run | The push is
rejected; notice, exit 0, nothing pushed |
| The newer merge's run | v0.6.0 with the `docs`, `fix` and `feat`
together |
| By hand, nothing new | `nothing to release since v0.6.0`, exit 1 (as
before) |
| By hand, only `docs` | v0.6.1 |
| A merge whose push is rejected by the server | exit 1 |

- The workflow file parses, and the step's script passes `bash -n`.
- Not run on GitHub: this session can't start workflows (HTTP 403, no
Actions write access). A dry run on this branch checks the run-by-hand
path there: `gh workflow run release.yml --repo hyperstructure/design
--ref fctl/36-look-into-https-github-com-hyperstructur -f dry_run=true`.
The merge path first runs when this merges, and should end with "No
release".

Session: https://app.fctl.sh/s/ses_01M57KT5CM8S7DMP21YJMN6JCK

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Oct 18, 2026
#65 was merged while `web/package.json` still pinned
`@hyperstructure/design` to hyperstructure/design#6's commit
(`b598996`). That pull request is now merged and released as
[v0.4.0](https://github.com/hyperstructure/design/releases/tag/v0.4.0),
so the web app moves to the tag. Its release notes:

> **Features**
> - **tokens:** Add hover, a fill for hovered rows and buttons
(hyperstructure/design#6)
>
> **Fixes**
> - **release:** Follow the commits when --bump is not given
(hyperstructure/design#8)

Nothing changes in the app. v0.4.0 ships the same `src/` and `assets/`
as `b598996`: `git diff b598996 v0.4.0 -- src assets README.md LICENSE`
is empty. Between the two, only the version, the changelog and the
release scripts changed, and the scripts aren't in the package.

## Verification

- `cargo xtask check` passes.
- `npm ci` installs v0.4.0 (`cf990d7`) from the lockfile. The lockfile
entry has the same shape as the v0.3.0 one did: the version and the
resolved commit, with no integrity line.
- With `cargo xtask dev`, I measured again, in both themes, the 13
hovered rows and buttons from #65's measurements. They come out pixel
for pixel as they did on `b598996`, and the floor looks as it did in
both themes.

No screenshots, because nothing people see changes.

Fixes #66

Session: https://app.fctl.sh/s/ses_01M57HTNZ0QVWB2TG8Q0CV38Q2

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

The release preview reports a patch bump unless --bump is given

1 participant