agentleFS
leroyguillaumeleroyguillaume/skills/release-script-conventions/SKILL.md

release-script-conventions

Skill7 starsChanged 3 days agoMITView on GitHub

Release flow: a `scripts/release.sh` that bumps and tags; CI publishes from the tag. TRIGGER when: creating or editing a release/bump script; wiring release automation; bumping the project's own `version`/`appVersion`; a workflow triggered by a `v*`/`chart-*` tag; user asks how to cut, tag or publish a release. SKIP when: reading a version, or bumping a dependency's.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    When the repo has a Taskfile.yml (task-conventions), a release task calls the script and adds nothing to it.

    line 42
  2. Distinctive:

    Use the ecosystem's own tool.

    line 75
  3. Distinctive:

    Run the generator with the *same* invocation the pre-commit hook uses, so the output is byte-identical and the hook stays green.

    line 101
  4. Very specific:

    Check all of these before touching anything, and exit 1 with a message naming the fix:

    line 125
  5. Distinctive:

    When a repo publishes more than one artefact — an application and its Helm chart is the common case — each versions independently:

    line 139
  6. Distinctive:

    Never bump the project's own version outside this script — not in a normal commit, not "just this once".

    line 192
  7. Distinctive:

    Never run the script as an agent, even when asked for a release: writing it is not permission to run it, and it commits on the default …

    line 197
  8. Distinctive:

    Never tag, push or publish a release yourself: that is the user's step, through the script.

    line 200
  9. Distinctive:

    Never hand-edit a lockfile to match a bumped manifest.

    line 202
  10. Distinctive:

    Never continue past a dirty tree, a stale branch, or an existing tag.

    line 203
  11. Distinctive:

    Never cut a release by editing a version field and tagging separately — that is precisely the drift the CI guard rejects.

    line 204

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Release script conventions

Every project that publishes an artefact ships scripts/release.sh

Cutting a release by hand is three separate steps — edit the version, regenerate whatever derives from it, tag with a name that matches — on the one operation that is awkward to undo once it has reached a registry. Three chances to get it wrong, and the failure mode is a published artefact whose metadata lies about what it is.

One script does all of it, in order, or none of it:

  1. bump the version stored in the repository
  2. regenerate every file derived from that version
  3. commit
  4. tag
  5. ask before pushing

The script is the only supported way to cut a release. Say so in CONTRIBUTING.md, and make CI enforce it (see the drift guard below).

The user runs it, never an agent. It commits and tags on the default branch, where an agent never commits, and its push is the publish. An agent writes and maintains the script, and delivers the changes a release will carry as pull requests; when asked for a release, it gives the user the command to run.

task release is the front door

When the repo has a Taskfile.yml (task-conventions), a release task calls the script and adds nothing to it; CONTRIBUTING.md and the command handed to the user say task release -- <version>.

  release:
    desc: Bump, commit and tag a release, then ask before pushing
    interactive: true
    cmds:
      - scripts/release.sh {{.CLI_ARGS}}

The logic stays in the script. Never a Task prompt: in its place: task --yes answers every prompt, which is the escape hatch the question below must not have. interactive: true hands the terminal to the script, so its own question still reads from a TTY.

The version lives in two places, and one tool writes both

  • The tag is what CI publishes from. vX.Y.Z → the image tag, the crate version, the GitHub release. Derive it at build time; never read it out of a file.
  • The repository still carries the same number, because a manifest whose version is permanently 0.0.0 lies to every tool that reads it — package managers, SBOM generators, dependency scanners, the user running --version.

These two are only safe because a single command writes both in one commit. That is the whole justification for the script existing; without it, two sources of truth is exactly the anti-pattern it looks like.

Where the version lives, per ecosystem

Use the ecosystem's own tool. It updates the lockfile as well, which hand-editing does not.

EcosystemFilesHow to write it
npmpackage.json, package-lock.jsonnpm version <v> --no-git-tag-version
RustCargo.toml, Cargo.lockcargo set-version <v> (cargo-edit)
Pythonpyproject.toml, uv.lockuv version <v>
HelmChart.yaml (version, appVersion)sed on the anchored top-level keys (^version:), then re-run helm-docs

Never hand-edit a lockfile to match a bumped manifest, and never write a version with an unanchored sed — version: appears inside dependency blocks too.

Regenerate what derives from the version

Anything generated from the version must be regenerated in the same commit, or the release commit fails its own pre-commit gate:

  • helm-docs chart READMEs — the badges embed version and appVersion
  • the helm install … --version X.Y.Z command in the root README.md, on a stable chart release only, since an rc must not become what the README tells people to install
  • lockfiles — handled by the ecosystem tool above
  • any --help dump or generated doc that prints the version

Run the generator with the same invocation the pre-commit hook uses, so the output is byte-identical and the hook stays green.

Never push on its own — ask

Pushing the tag is what publishes. That is outward-facing and effectively irreversible once a registry has served it, so it is never automatic:

printf 'push %s and %s to origin? this publishes the release. [y/N] ' "$branch" "$tag"
read -r reply
  • Default to No. A bare Enter declines.
  • No terminal, no push. Guard with [ -t 0 ] and decline when stdin is not a TTY — a pipe or a CI job must not publish, and read must not hang.
  • Declining is not a failure. Print the exact push command so the user can run it later; the commit and tag stay on their machine.
  • No --push / --yes escape hatch. A flag that skips the question is the question not being asked. Automation that genuinely should publish pushes the tag itself rather than driving this script.

Refuse rather than guess

Check all of these before touching anything, and exit 1 with a message naming the fix:

  • the version argument is semver, and given explicitly — never infer a bump from commit messages or auto-increment a component
  • the working tree is clean
  • the branch is the default branch
  • the branch is not behind origin (git fetch first, then git rev-list --count HEAD..origin/<branch>)
  • the tag does not already exist
  • for a chart, the appVersion being pinned refers to a real released tag

Separate lifecycles get separate tag namespaces

When a repo publishes more than one artefact — an application and its Helm chart is the common case — each versions independently:

  • vX.Y.Z → the application
  • chart-X.Y.Z → the chart, selected with a --chart flag

For a chart, default appVersion to the most recent v* tag so a chart release targets the newest application release, and expose --app-version to pin a different one. version comes from the chart's own tag; the two never share a number.

CI must guard the drift

Two sources of truth are only safe if disagreement is loud. Every tag-triggered publish workflow re-derives the version from the tag and refuses to run when the committed file disagrees:

      - name: derive the version from the tag
        id: version
        run: |
          version="${GITHUB_REF_NAME#v}"
          committed="$(jq -r .version package.json)"
          if [ "$committed" != "$version" ]; then
            echo "package.json says ${committed} but the tag says ${version}." >&2
            echo "Cut releases with scripts/release.sh so the two stay in step." >&2
            exit 1
          fi
          echo "version=${version}" >> "$GITHUB_OUTPUT"

This is what makes hand-tagging fail fast instead of publishing a mislabelled artefact. For every chart tag, rc included, the guard checks version in Chart.yaml; for a stable one, also the --version in the README's helm install command.

--dry-run

Report the current and target values, the commit subject and the tag, then stop. Change nothing, and never prompt — there is nothing to push.

Shape and quality

  • #!/usr/bin/env bash, set -euo pipefail, and shellcheck clean — wire the script into the shellcheck pre-commit hook like any other (see pre-commit-conventions).
  • A usage() heredoc behind -h / --help, with worked examples.
  • cd "$(git rev-parse --show-toplevel)" so it works from any subdirectory.
  • Annotated tags (git tag --annotate), so the tag carries an author and date.
  • Errors to stderr through a die() helper; never exit 0 on a failed check.

Never:

  • Never bump the project's own version outside this script — not in a normal commit, not "just this once". In a repo that publishes without one, a bump the user asks for is made by hand, and the script proposed as its own change. A chart or package the project consumes is a dependency bump, not this.
  • Never run the script as an agent, even when asked for a release: writing it is not permission to run it, and it commits on the default branch. Hand the user the command instead.
  • Never tag, push or publish a release yourself: that is the user's step, through the script.
  • Never hand-edit a lockfile to match a bumped manifest.
  • Never continue past a dirty tree, a stale branch, or an existing tag.
  • Never cut a release by editing a version field and tagging separately — that is precisely the drift the CI guard rejects.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.