`branch` and `release` were bare commands, but bare in this repo means "how you invoke a tier" or "runs one tool" — neither fits a command that opens or closes a unit of work. They get their own prefix now, since a prefix is how this repo records _when_ a script runs. `create:` because both members genuinely create something (a branch, a release) and it is a plain verb rather than VCS slang. No bare `create` aggregator: running "all the workflows" describes nothing anyone wants, and `publish:*` already precedents a prefix without one. The rule "reuse an existing prefix, never invent one" now says what it actually means: a new prefix is allowed when the scripts belong in the pipeline, provided it enters both lists in the same commit as its first member. That is the lesson from `use:`, which is referenced by prose yet in none of the lists — already tracked in backlog.tasks. The bare-command sentence shrinks to `build`, `clean`, `verify`.
67 lines
2.2 KiB
Bash
Executable File
67 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
# Release front-door. Run as `npm run create:release`.
|
|
#
|
|
# How we got here (short): we want hand-written Keep-a-Changelog notes, an
|
|
# [Unreleased] -> "## [x.y.z] - DATE" graduation, and a tag that marks the exact
|
|
# commit on main that gets published. No single tool did BOTH the [Unreleased]
|
|
# graduation AND the package.json bump. So split by strength: `pubv` (tiny,
|
|
# changelog-driven) owns preflight + the interactive major/minor/patch heuristic
|
|
# + graduating/committing CHANGELOG.md (no tag, no push); `npm version` syncs
|
|
# package.json + the lockfile; `--amend` folds them into pubv's single commit;
|
|
# tag AFTER the amend (so the tag is never orphaned) and push.
|
|
#
|
|
# Rejected: the conventional-commits family (our history is gitmoji, not
|
|
# Conventional; and we want hand-written notes); changesets/rtk (config + a
|
|
# heavier version/publish flow that fights our CI-only publish); knope/kacl/
|
|
# bestikk (changelog-only — don't bump package.json; plus 5yr/2yr/brand-new
|
|
# maintenance); pubv alone (verified it never writes package.json). We also
|
|
# tried `versions` (silverwind) — great Gitea support — but pairing it with a
|
|
# hand-rolled promote became a ~180-line script we'd have to maintain, which is
|
|
# exactly what this ~30-line version replaces.
|
|
|
|
CHANGELOG="CHANGELOG.md"
|
|
|
|
if ! command -v code >/dev/null 2>&1; then
|
|
echo "Error: 'code' (VS Code CLI) not found; install it or remove the editor step." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Running pubv..."
|
|
pubv --no-tag --no-push --tag-prefix=none
|
|
|
|
echo "Opening ${CHANGELOG} in VS Code..."
|
|
code --wait "${CHANGELOG}"
|
|
|
|
echo "Reading version from ${CHANGELOG}..."
|
|
|
|
VERSION=$(
|
|
sed -nE 's/^## \[([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/p' "${CHANGELOG}" |
|
|
head -n 1
|
|
)
|
|
|
|
if [ -z "${VERSION}" ]; then
|
|
echo "Error: Could not determine release version from ${CHANGELOG}." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Release version: ${VERSION}"
|
|
|
|
echo "Updating package.json and package-lock.json..."
|
|
npm version "${VERSION}" --no-git-tag-version
|
|
|
|
echo "Amending release commit..."
|
|
git add package.json package-lock.json "${CHANGELOG}"
|
|
git commit --amend -m ":bookmark: Release ${VERSION}"
|
|
|
|
echo "Creating tag ${VERSION}..."
|
|
git tag "${VERSION}"
|
|
|
|
echo "Pushing release..."
|
|
git push
|
|
git push --tags
|
|
|
|
echo "Release ${VERSION} completed."
|