Skip to content

Latest commit

 

History

History
183 lines (144 loc) · 10.2 KB

release.md

File metadata and controls

183 lines (144 loc) · 10.2 KB

release.sh

Revision: 1 Last modified: 2026-12-04T17:48:16Z

Overview

The one command that releases a project — any project that incorporates the Helix Constitution, and the Constitution itself. It commits pending work, prepares and validates the release, pushes to every upstream, creates the tag, publishes platform releases, and opens the next development cycle.

Run from a project root it releases that project; run from the Constitution's own root it releases the Constitution. The behaviour is identical — only the data differs (tag prefix, changelog, targets), and that data is read from the project, never hardcoded.

Run it when: you are cutting a release. Not when you want a tag only (scripts/release_tag.sh — no commit, no push, no publish) or a publish of an existing tag (--publish-only).

The default is a dry run. --release (or --yes) is required to change anything.

This file is a thin shim: scripts/release.sh resolves itself (it is usually a symlink to <constitution>/scripts/release/release_all.sh) and forwards every argument. The real implementation is release_all.sh; the companion guide is docs/scripts/release_all.md.

Prerequisites

  • A git work tree — the script dies with exit 2 ("not inside a git work tree") otherwise.
  • git, curl, python3. gh is optional: GitHub falls back to REST. GitLab always uses REST.
  • Optional: config/release.conf (or --conf FILE) for target/tag configuration. Without it, configuration is derived from the git remotes.
  • Optional: ~/api_keys.sh for platform tokens — read by VARIABLE NAME only, never printed. A configured platform whose token is absent is reported SKIP, never an error.
  • Permissions: push access to every upstream you intend to release to.

Usage examples

# The default: print every action, change nothing
bash scripts/release.sh

# What you actually run to release (interactive confirmation, listing every platform and repository)
bash scripts/release.sh --release

# Automation: no question
bash scripts/release.sh --yes

# Rehearse with the heavy §11.4.40 full-suite retest as the validation gate
bash scripts/release.sh --dry-run --with-retest

# A specific tag, full release, restricted platforms
bash scripts/release.sh --tag helixconstitution-v9.4.0 --production --platforms "github gitlab"

# Commit + tag + handover only, no platform releases
bash scripts/release.sh --yes --no-publish

# Publish an EXISTING tag: no commit, no new tag, no handover
bash scripts/release.sh --release --publish-only --tag helixconstitution-v9.4.0

# Non-standard configuration
bash scripts/release.sh --dry-run --conf config/release.conf

# The help text
bash scripts/release.sh --help

What you should see: with --help, exactly the text reproduced under "Verified --help output" below. On a real run: a === banner per phase, say-level per-step lines, then one PASS/SKIP/FAIL line per platform, and an evidence report at docs/qa/releases/<tag>.md.

Verified --help output

Reproduced from a real run on 2026-12-04 (bash scripts/release.sh --help, exit 0):

Purpose:  The ONE command that releases a project — any project that incorporates the Helix
          Constitution, and the Constitution itself. It commits pending work, prepares and validates
          the release, pushes to every upstream, creates the tag, publishes platform releases, and opens
          the next development cycle. Run from a project root it releases THAT project; run from the
          Constitution's own root it releases the Constitution. The behaviour is identical; only the
          data differs (tag prefix, changelog, targets), read from the project — never hardcoded.

Usage:    scripts/release.sh [options]        (the per-project shim; forwards every argument)
          scripts/release/release_all.sh [options]

          options:
            --release         perform a REAL release: asks for interactive confirmation, listing every
                              platform and repository it will publish to (this is what /release runs)
            --yes | -y        perform a real release without asking (automation; implies --release)
            --dry-run         print every action, change nothing (DEFAULT when no --yes is given)
            --tag TAG         release an explicit tag instead of the derived next version
            --with-retest     run the heavy full-suite retest as the validation gate (§11.4.40)
            --production      label the release a full release (default: provisional pre-release)
            --prerelease      label the release a provisional pre-release (default)
            --no-publish      skip platform releases (commit + tag + handover only)
            --platforms "<p> ...|all"  where <p> ∈ github gitlab codeberg m3w gitverse gitflic
                              bitbucket azuredevops codecommit gitee      (default: all)
                              Only the platforms the project CONFIGURES are used; a configured
                              platform whose token is absent is reported SKIP, never an error.
            --publish-only    publish an EXISTING tag; no commit, no new tag, no handover
            --allow-dirty     permit a still-dirty tree at tag time. Rarely needed: phase 5 commits
                              everything first, so this only covers changes a hook or generator makes
                              AFTER that commit. It is NOT a way to protect uncommitted work.
            --conf FILE       read target/tag configuration from FILE
            --quiet           suppress per-step detail (errors and the summary always print)
            -h | --help       this text

Inputs:   the git work tree of the project it is invoked in; an optional config/release.conf;
          ~/api_keys.sh (tokens read by VARIABLE NAME only, never printed)
Outputs:  one PASS/SKIP/FAIL line per platform; an evidence report at docs/qa/releases/<tag>.md
Side-effects: commits, pushes to every upstream, creates and pushes a tag, creates platform releases,
          commits the next-cycle changelog entry. A dry run does NONE of these.
Exit:     0 complete (or a clean dry run) · 1 aborted or partially published · 2 usage/environment error
Dependencies: git, curl, python3; gh optional (GitHub falls back to REST). GitLab always uses REST.

Exit codes

Code Meaning
0 Complete — or a clean dry run
1 Aborted, or partially published
2 Usage / environment error — including "not inside a git work tree", an unknown argument, an unknown --platforms value, and a symlink chain longer than 40

Edge cases

  • The shim is usually a symlink. $0 is the link, so the script resolves the chain (cd -P + readlink) before deriving anything. Without that, the Constitution root would be taken for the project root and every project would be treated as the Constitution. A chain longer than 40 hops exits 2 — that branch is unreachable in practice (the kernel refuses ELOOP first at MAXSYMLINKS=40) and the script says so rather than pretending to test it.
  • Nothing is left in /tmp. One per-run scratch directory (${TMPDIR:-/tmp}/helix-release.XXXXXX) is created and removed by an EXIT INT TERM HUP trap, guarded with ${VAR:?}. Fixed /tmp/<name> payload files used to collide between concurrent releases.
  • A configured platform with no token is SKIP, never an error, and never a partial-failure exit.
  • --allow-dirty is not a safety net. Phase 5 commits everything first, so it only covers changes a hook or generator makes after that commit.
  • --platforms is validated up front against the closed set; an unknown name is a hard exit 2 before any work.
  • --publish-only requires an existing tag and does no commit, no new tag, no handover.
  • --quiet suppresses per-step detail only — errors and the summary always print.

Internal behaviour

  1. Resolve the symlink chain to the real file; derive SCRIPT_DIR and CONSTITUTION_ROOT.
  2. Create the per-run scratch directory and its trap.
  3. Parse flags into WANT_REAL / DO_IT / WITH_RETEST / PUBLISH / CLASS / TAG / PLATFORMS.
  4. Resolve project identity: git rev-parse --show-toplevel, basename, and IS_CONSTITUTION (project root equals the constitution root).
  5. Validate --platforms against the closed set github gitlab codeberg m3w gitverse gitflic bitbucket azuredevops codecommit gitee.
  6. Read configuration in order: --conf FILE, then <project>/config/release.conf, then derivation from the git remotes.
  7. Run the release phases: commit pending work, prepare/validate, push every upstream, create and push the tag, publish platform releases, commit the next-cycle changelog entry — writing the evidence report at docs/qa/releases/<tag>.md.

Related scripts

  • scripts/release/release_all.sh — the implementation this shim forwards to; docs/scripts/release_all.md is its guide.
  • scripts/release_prefix.sh — the single source of the <PREFIX> used in tag naming (§11.4.151). docs/scripts/release_prefix.md.
  • scripts/release_tag.sh — annotated tag only, no commit/push/publish. docs/scripts/release_tag.md.
  • scripts/release_publish_gitea.sh — the Gitea/Forgejo release publisher for the m3w platform (docs/scripts/release_publish_gitea.md).
  • scripts/run_full_suite.sh — what --with-retest runs. docs/scripts/run_full_suite.md.
  • Constitution anchors: §11.4.151, §11.4.230(F), §11.4.290, §11.4.299, §2.1, §11.4.10.

Last verified

2026-12-04 — bash -n clean, and --help executed for real (it is a pure sed of the header before any project resolution; exit 0, output reproduced above):

$ bash -n scripts/release.sh && echo PARSE-OK
PARSE-OK

$ bash scripts/release.sh --help | head -3
Purpose:  The ONE command that releases a project — any project that incorporates the Helix
          Constitution, and the Constitution itself. It commits pending work, prepares and validates
          the release, pushes to every upstream, creates the tag, publishes platform releases, and opens

A reader can reproduce both lines. No release was performed. To rehearse safely, run bash scripts/release.sh with no arguments — the default is a dry run that prints every action and changes nothing.