Skip to content

Latest commit

 

History

History
1042 lines (780 loc) · 116 KB

release.md

File metadata and controls

1042 lines (780 loc) · 116 KB

The release workflow

setdef/Cutter/.github/workflows/release.yml is a reusable workflow. The release job of your CI workflow calls it with uses:. In a run for trunk or a release/X.Y branch, it shows the version the commit would release as. When the changelog lists something new, it then releases the commit itself, from the files that run built with that version and tested, with no tag pushed, as Releasing a commit with no tag pushed describes. In a run for a version tag you push, such as v1.0.0, it releases what that run built. Such a run also records a release that GitHub published before its commit and that your changelog has no record of yet, and from 1.0.0 on moves stable to it. A run for any other branch succeeds with a notice that it previews nothing there.

From 1.0.0 on, the job also carries each fix that releases from trunk onto each release line, such as release/1.0, that your backport policy keeps living, and cuts a line's branch when the line first takes a fix, as Carrying fixes to release lines describes.

The steps to release are in Release a version, and the reasons behind its rules in Why a release is a tag on a proven commit.

Calling it

Call it from a job of the workflow that tests and builds your project, with every other job that builds or tests in its needs:. Those jobs include one that calls the version workflow, whose version output your build jobs build with:

  release:
    needs: [version, test, package]
    if: ${{ !cancelled() }}
    uses: setdef/Cutter/.github/workflows/release.yml@722bc85807fa248115a93fe5329187a0811bab37 # v0.9.3
    permissions:
      contents: write
      actions: write
      issues: write
    with:
      artifact: release

The job pins Cutter by commit, as Pinning Cutter says.

With every other job that builds or tests in its needs:, the release job starts once they have ended, and step 4 checks that each of them passed. A job that needs release, such as one that publishes the release's files to a package registry, starts after release has ended, so it isn't one of the jobs checked.

The line if: ${{ !cancelled() }} makes GitHub start the job when a job in its needs: failed or was skipped, which Cutter needs, since only a job that starts can check the run. Without the line, GitHub skips a job whose needs: holds a job that failed or was skipped, unless the job's if: says otherwise (jobs.<job_id>.needs), so Cutter's check would never run. In a run for a tag, that leaves a tag that never released and no issue to tell you (Issues for a person). With the line, Cutter's check finds the job that didn't pass and stops the release: a run for a tag files its issue, and a run for a branch holds its release with a warning. The job succeeds in both cases, so it adds no red job to a run that is already red.

!cancelled() is false in a run someone canceled, so a canceled run skips the job. always() is true in a canceled run too, and GitHub recommends !cancelled() for a job that should run whether or not the jobs before it succeeded (Status check functions). A job's if: that starts with ! goes in ${{ }}, since YAML reserves ! (jobs.<job_id>.if), and a job that calls a reusable workflow may have an if: (Supported keywords for jobs that call a reusable workflow). Cutter counts a skipped job as one that didn't pass, so a job in the release job's needs: that an if: of yours skips stops the release.

The workflow that calls it runs for pushes to trunk, to release/**, and of v* tags, and for workflow_dispatch. With the packages input, it also runs for pushes to each package's release branches, which */release/* matches for invoice/, and */*/release/* for gems/invoice/, since * matches no slash in GitHub's filter. Getting started shows such a workflow in full. The calling workflow may run for other branches too, as when it runs on every branch, or on the bisect/ branches that the build cop makes: the release job then passes with a notice and does nothing, so it turns no such run red.

What a run does

The run is for What the job does
A push to, or workflow_dispatch on, trunk or a release/X.Y branch It works out the version the commit would release as, and writes it in the run's summary and its outputs, as The summary of a run on a branch shows. When a tag of that version on the commit couldn't release it, it says so and why, and writes no version. With the packages input, it does so for each package. With that input, a package's release branch, such as invoice/release/1.0, is the same kind of run, for that package alone. When it names a version, it tags the commit and releases it, as Releasing a commit with no tag pushed describes, unless you set release-without-tag to false. When a file that states the version, as Version files lists them, states another, it writes the version into the files in a commit instead, and releases nothing. Otherwise it publishes nothing, and pushes nothing either, unless a release published before the commit isn't recorded on trunk, or stable lags behind it: It then records the release, or moves stable, as Finishing a release on a later run describes. It checks that every other job of the run passed only before it releases the commit it is for.
A push to, or workflow_dispatch on, any other branch It succeeds. It writes a notice and a line of the run's summary that say it previews nothing on the branch, and which branches it previews, as A run for another branch shows. It sets published and record to false and no other output. It asks GitHub for nothing but the settings file, which it reads first, with the packages input, so a file or an input it can't use still stops the run.
A push of a tag It releases the tagged commit, in the steps below. A tag that Cutter made in a run for a branch, and that GitHub started a run for, as it does for a tag made with a GitHub App's token, ends with a notice before step 2, since its release is published and recorded.
A tag by any event but push, or any event but push and workflow_dispatch It stops with an error and changes nothing.

A release goes through these steps in order, and stops at the first one that fails, with the message Why a run stops gives. A run for a tag doesn't always go through them all: when the tag is named as step 1 says, GitHub has published its release, and the release's record is finished, as step 6 says, the run ends before step 2 with the notice GitHub has a release v0.4.0 already, and its record is finished, so this run has nothing left to do, and succeeds, whatever the other jobs of the run did.

  1. The tag is an annotated tag named v plus a version, such as v0.4.0 or v1.0.1. With the packages input, it is named a package's tag prefix, v, and a version, such as invoice/v0.4.0, and each step after this one concerns that package alone: its tags, its changelog, and its release.
  2. The tag still points at the commit this run built.
  3. The tagged commit is on trunk. A tag of a patch release from 1.0.0 on may instead be on the branch release/X.Y of its major and minor numbers: v1.0.1 on release/1.0. A package's tag of such a patch may instead be on the package's release branch, its tag prefix and then release/X.Y: invoice/v1.0.1 on invoice/release/1.0. A package's tag of any other version must be on trunk.
  4. Every other job of this run succeeded, on its latest attempt. A skipped job counts as failed.
  5. The tag's version is the one the changelog at the tagged commit calls for, by the rules in How Cutter picks a version, or it is 1.0.0 after a 0.X.Y release. The changelog lists something the release before it didn't. For the version, the release before it is the highest version tagged on a commit that comes before the tagged commit, whether or not GitHub has a release of it. For what's new, it is the highest such version that GitHub has a published release of. When the changelog at the tagged commit has a ## [X.Y.Z] heading for that version, with or without a date, every entry under its ## [Unreleased] is new. Otherwise, the new entries are those under ## [Unreleased] that are left after taking away, one for one, the entries under ## [Unreleased] at that release's commit, and the entries of that release reworded since, as How Cutter picks a version says.
  6. GitHub has no published release for the tag, or has one that isn't finished yet. A published release is recorded when trunk's changelog has a ## [X.Y.Z] heading for its version, with or without a date. When a release is published and not recorded, the run publishes nothing and goes on to step 9, so a record that stopped is made by running the job again. The next run for the branch the tag is on records it too, as Finishing a release on a later run describes. The run also goes on to step 9, publishing nothing, for a published and recorded release that step 10 would move stable to and that stable doesn't point at yet, so a move that stopped is made by running the job again. A draft release for the tag, which an earlier run left when it failed in the middle of step 8, doesn't stop the run: step 8 deletes it.
  7. Each file that states the project's version in the tagged tree, as Version files lists them, states the tag's version. This run uploaded the artifact you name, and it holds at least one file. With no artifact input, the artifact passes: there is nothing to publish.
  8. Cutter deletes each draft release of the tag, and says on standard error that it did, with the draft's ID. Then it creates the GitHub release from the existing tag as a draft, titled with your title and the version. Its notes are the changelog's entries that are new since the published release before it, as step 5 counts them, each under its ### heading. Its files are every file in the artifact, and a SHA256SUMS file that Cutter writes for them and uploads last. With no artifact input, it has no files, and no SHA256SUMS either. GitHub renames a file whose name has special characters or a leading or trailing period, so SHA256SUMS lists each file under the name GitHub stored it by, and sha256sum --check SHA256SUMS works on the files as people download them. Once every file is up, it publishes the draft. When an upload or the publishing fails, Cutter deletes its draft, as far as it can, and stops with a message that says whether the release was published.
  9. Cutter records the release, as The record commit describes.
  10. From 1.0.0 on, when the version is higher than that of every other release GitHub has published, Cutter moves the branch stable to the tagged commit, and creates it at the first stable release, as Moving stable describes. It does so only once step 9 has recorded the release on every branch, and moves stable for no package.

A run that stops before step 8 publishes nothing, and so does a run that stops in step 8 with a message that says the release was not published. A run that stops after it has published the release leaves it published. A later run for the same tag goes on to step 9 when trunk's changelog has no heading for the release, and otherwise ends before step 2 with the notice that it has nothing left to do. It also goes on to step 9 when step 10 would move stable and stable doesn't point at the tagged commit. A run that goes on to step 9 first passes steps 1 to 5, so a run records only a release that its tag and commit would have released.

Cutter doesn't check who pushed a tag. GitHub lets only the accounts that your tag ruleset allows push the tag v1.0.0, and refuses that push from anyone else. Anyone who may push tags can push every other tag.

Releasing a commit with no tag pushed

A run for trunk or a release/X.Y branch whose summary says 4f2a9c1 would release as v0.4.0 releases that commit itself, once every other job of the run has passed, from the files that run built and tested. Nobody pushes a tag, and no second CI run tests the commit. With the packages input, a run for one package's release branch, such as invoice/release/1.0, releases that package the same way. Cutter never picks 1.0.0 or a prerelease, so such a run never makes either: v1.0.0 is a tag you push, as Release 1.0.0 says.

The run goes through these steps in order. A step that holds the release back writes why, as a notice or a warning and in the summary, publishes nothing, and the job succeeds, since nobody asked for this release. First, when a file that states the version, as Version files lists them, states another, the run writes the version into the files in a commit, and releases nothing: the run of that commit releases it.

  1. Your CI workflow has a job that calls the version workflow, at the same commit of Cutter as the release workflow and with the same changelog and packages inputs, and that job named the version this run would release. Your build jobs built with its version output, so the files carry that version.
  2. No tag of the project is on a commit that comes after this one, and no other tag of the project is on this commit. Runs end out of order, so a run for an older commit that ends after a newer commit's release releases nothing, and a tag you pushed on the commit, such as v1.0.0, is released by the run for that tag.
  3. When GitHub has a published release of the tag already, as after you run the job again, the run records it, as Finishing a release on a later run describes, or, when it is recorded, has nothing left to do.
  4. Every other job of this run succeeded, on its latest attempt, and this run uploaded the artifact you name, with at least one file, as steps 4 and 7 of a run for a tag check.
  5. Cutter tags the commit with an annotated tag of the version, such as v0.4.0, whose message is its name, by github-actions[bot], with the run's token. GitHub refuses the run's token a tag at a commit whose workflow files differ from those on your default branch: there Cutter tags with the token of your GitHub App, and without one it holds the release. On your default branch the next commit's run has the default branch's workflow files and releases the changes, so Cutter writes a notice and files no issue. On any other branch, such as a release branch, or trunk once stable is your default branch, a later commit's run releases the changes only when its workflow files are your default branch's, so Cutter also files an issue: Issues for a person. When the tag is on the commit already, as after an earlier try of this run, Cutter makes none.
  6. Cutter publishes the release, as step 8 of a run for a tag does: the same title, the notes from your changelog, the artifact's files, and SHA256SUMS.
  7. Cutter records the release and moves stable, as steps 9 and 10 of a run for a tag do.

The release looks as one from a pushed tag does: the tag's name and annotation, the release's title, notes, and files, its record commit, and the outputs, with published and record set to true. The summary says Published the release v0.4.0 of 4f2a9c1e0b7d3a5c8f6e2d1b9a0c7e5f3d2b1a09.

A tag made with the run's token starts no workflow run. A tag made with a GitHub App's token starts the workflows that run on a push of it, so your CI runs for the tag, and its release job ends with a notice that it has nothing left to do, before step 2.

What a run writes when it holds the release:

Message Kind Cause
4f2a9c1 would release as v0.4.0, but this run has no record from Cutter's version workflow, so its build may carry another version, and Cutter releases nothing: add a job that calls setdef/Cutter/.github/workflows/version.yml, build with its version output, and put the job in the needs of your build jobs and your release job notice The run has no job that calls the version workflow. Publish what your CI builds shows one.
the version workflow ran Cutter at c0ffee0, and the release workflow at 1a2b3c4, so Cutter releases nothing: pin both at one commit warning The two uses: lines pin different commits of Cutter.
the version workflow's changelog input differs from the release workflow's, so Cutter releases nothing: give both the same changelog input warning The two workflows read different changelogs. The same holds for the packages input.
the version workflow named no v0.4.0 for this run's build, so its files may carry another version, and Cutter releases nothing: a later commit's run releases 4f2a9c1's changes warning The version workflow named another version, or none, as when a tag was pushed between the two jobs, or GitHub failed it.
the version workflow's record in this run is no JSON object, so Cutter releases nothing warning The artifact cutter-version holds something other than the version workflow's record: text that is no JSON, or JSON that is no object, such as an array.
v0.4.1 is on 5b0c1d2, which comes after 4f2a9c1, so Cutter releases nothing from 4f2a9c1: no release comes after a newer one notice A newer commit's run released, or a tag is on a newer commit.
v1.0.0 points at 4f2a9c1 already, so the run for that tag releases it notice You pushed another tag on the commit.
test did not pass in this run, so v0.4.0 is not released warning A job of the run failed or was skipped, or is still running.
this run uploaded no artifact named release warning The artifact is missing, or holds a file the release can't publish, with the messages Why a run stops gives for a run for a tag.
the workflow files at 4f2a9c1 differ from those on the default branch, and GitHub refuses the run's token a tag at such a commit, so Cutter releases nothing from 4f2a9c1: trunk is the default branch, so the next commit's run releases its changes notice GitHub would refuse the run's token the tag, you gave no App, and the run is for your default branch, here trunk. The next commit's run has the default branch's workflow files, so it releases the changes, and Cutter files no issue.
the workflow files at 4f2a9c1 differ from those on the default branch, and GitHub refuses the run's token a tag at such a commit, so Cutter releases nothing from 4f2a9c1: a later commit's run releases its changes, or give the release workflow a GitHub App with the app-id input and the app-private-key secret notice GitHub would refuse the run's token the tag, you gave no App, and the run is for another branch than your default branch. On a release branch, whose workflow files usually differ from trunk's, every run holds its release until you give an App, and Cutter files an issue that says so.
the app-id input is set, but the release step got no app-private-key secret warning The tag needs the App, and the App has a problem, with the messages Why a run stops gives for the record step.
a run for trunk releases no package while the packages input lists two or more, since its outputs and its record step hold one release: push the tag of the package you release, such as invoice/v0.4.0 notice With two or more packages, a run for trunk releases none of them. A run for a package's release branch releases that package.

A run that holds its release then finishes an older release, as Finishing a release on a later run describes. When GitHub fails a request before the release is published, the run stops with the message Why a run stops gives, as a run for a tag does, and running the job again goes on from the tag it made.

Version files

Not in v0.9.1 or earlier: setdef/Cutter#98.

Cutter keeps the files that state your project's version, such as a gem's version.rb or a crate's Cargo.toml, in step with the version it releases, so that the tree of each tag states the version it is tagged as. You list the files in the settings file, under version-files. Cutter runs none of your code to read or write them: each file's entry, its declaration, says where the version stands on one line, and Cutter rewrites the version there and leaves every other byte of the file as it was, line endings included.

version-files:
  - path: lib/invoice/version.rb
    kind: version.rb
  - path: README.md
    below: "## Install"
    before: 'tag: "v'
    after: '"'

The version commit

A passing run for trunk or a release branch that would release a version, as The summary of a run on a branch shows it, reads each declared file at its commit, through GitHub's API. When every file states that version, the run releases as Releasing a commit with no tag pushed describes. When one states a lower version, the run releases nothing and writes the version instead, in a commit on the branch's tip. When one states a higher version, it writes nothing, as A version higher than the preview describes.

  1. Nothing holds the commit back: each file holds the line its declaration describes and states a version of three numbers, such as 0.3.2, no tag of the project is on a later commit, or another on this one, and every other job of the run succeeded, as for a release.
  2. Cutter fetches the branch's tip with git, writes the version into each file, and commits, as github-actions[bot], with the message chore: write v0.4.0 into the version files. It writes nothing for a project whose files at the tip state another version than at the run's commit: a later commit changed them, and that commit's run decides.
  3. It pushes without force: with the run's token on your default branch, and elsewhere where the tip's workflow files are the default branch's, and otherwise with your GitHub App's token. Without an App there, it writes nothing, says so in a notice, and files an issue.
  4. After a push with the run's token, it starts your CI workflow on the branch with workflow_dispatch, since GitHub starts no workflow for that push. After a push with the App's token, GitHub starts the workflows that run on a push.
  5. When another push lands first, it starts again from the branch's new tip, up to three tries in all.

The run of the version commit, or of any later commit, finds the files stating the version and releases it. So each new version costs one more CI run, and its release waits for that run. The version commit is written whether or not release-without-tag is true, and with two or more packages one commit writes every package's version, so a tag you push on it or after it states its version too.

A version higher than the preview

Cutter never lowers a version that you declared. When a declared file states a version higher than the one the run previews for the project, the run writes nothing for that project and releases nothing from the commit as that version, and a notice lists each such file, what it states, and the version the run previews. It files no issue, since the files are ahead because you chose that. The versions are compared number by number, so 0.10.0 is higher than 0.4.0. With two or more packages, a package whose files are higher is left alone, and the version commit writes the others.

So raising the files by hand is how you choose a version Cutter never picks, such as 1.0.0: write it into the files, in the commit you tag or an earlier one, and no run writes it back, whether or not the tag is pushed yet. Once the version the run previews is higher than the files state, as after you release 1.0.0 and a fix calls for 1.0.1, the next run writes it (Release 1.0.0).

A file that states a version that isn't three numbers, such as 1.0.0-rc.1, can't be compared with the preview, so the run releases nothing and files the release's issue, as for a file with no line its declaration describes.

A run for a tag you push

A run for a tag reads each declared file in the tagged tree, after it checks the tag's version against the changelog, and releases nothing when one doesn't state the tag's version. It stops with a message that lists each such file and what it states, and files the release's issue, as for any stop of a run for a tag: Why a run stops. A tag's version is used up once it is pushed, so write the next version into the files, and release that one.

Declarations

Each entry of version-files has a path, from your repository's root, by the rules of changelog, and either a kind or the texts around the version on its line.

Key Value
path The file's path, such as lib/invoice/version.rb. Cutter writes no file through a symbolic link.
kind One of the kinds in the table that follows, whose line Cutter knows.
before The text right before the version on its line, such as VERSION = ". Empty means the version starts its line.
after The text right after the version, such as ". Empty means the version ends its line.
below Optional: the text a line starts with, after which Cutter looks, such as [package]. Cutter looks up to the next line that starts with this text's first character, so below [package] it stops at the next TOML table, and below ## Install at the next heading.

Every text is literal, compared byte for byte, and never a regular expression. The version's line is the first line, below the below line when there is one, that holds before, then a version, then after. A version is a digit, then letters, digits, ., +, and -, up to 256 bytes. A declaration gives before and after both, with below or without, or a kind alone. No text may hold a line break, and below may not be empty.

kind The line Cutter finds
version.rb VERSION = "0.4.0", as bundle gem writes lib/NAME/version.rb.
gemspec .version = '0.4.0', as in spec.version = '0.4.0'. A gemspec that reads VERSION from version.rb, as bundle gem writes it, needs no entry.
package.json "version": "0.4.0".
Cargo.toml version = "0.4.0", below [package]. A Cargo.toml whose [package] has version.workspace = true matches nothing: declare the workspace's root, below [workspace.package].
pyproject.toml version = "0.4.0", below [project].

Each kind is a declaration Cutter ships, so a kind it lacks is one you write yourself, as the README.md entry in the example does. A file that states the version on several lines, such as package-lock.json, needs one declaration for each line that a before, an after, and a below can tell apart; one that states it across several lines, or on a line no such texts tell apart, can't be declared.

A repository of one project gives version-files at the top level of the file. A repository of several packages gives each package's in its entry of packages, and the top-level key beside packages is refused:

packages:
  - prefix: invoice/
    changelog: gems/invoice/CHANGELOG.md
    version-files:
      - path: gems/invoice/lib/invoice/version.rb
        kind: version.rb

Like backports, the top-level version-files is read whichever of the file and the inputs gives the other settings, so a file that holds only version-files leaves the five settings to the inputs. With a packages input that lists packages, the top-level key is refused, since its files are no one package's: move the packages into the file.

Leave the files you declare out of your record-command. The record step runs it on the branch as it stands after the release, where a later version commit may have written a higher version.

What a run says

Message Kind Cause
the version files at 4f2a9c1 don't all state 0.4.0: lib/invoice/version.rb states 0.3.2, so Cutter releases nothing from 4f2a9c1: it wrote v0.4.0 into them in 9c8b7a6 on trunk, and started ci.yml there notice Cutter pushed the version commit with the run's token. After a push with the App's token, the message ends where the push starts your workflows.
the version files at 4f2a9c1 don't all state 0.4.0: lib/invoice/version.rb has no line its declaration describes, so Cutter can't write 0.4.0 into them, and releases nothing from 4f2a9c1: put the version-files setting right warning A declared file holds no line its declaration describes, or isn't a file at the commit. Cutter files the release's issue.
lib/invoice/version.rb states 1.0.0, higher than 0.4.0, which this run previews as v0.4.0, so Cutter writes nothing into the version files at 4f2a9c1 and releases nothing from 4f2a9c1 as v0.4.0: it never lowers a version notice A declared file states a version higher than the one the run previews: A version higher than the preview. With several files, the message lists each such file before higher than, such as lib/invoice/version.rb states 1.0.0, VERSION states 0.5.0, higher than 0.4.0. Cutter files no issue.
the version files at 4f2a9c1 don't all state 0.4.0: lib/invoice/version.rb states 1.0.0-rc.1, and Cutter can't tell whether a version that isn't three numbers is higher than 0.4.0, so it releases nothing from 4f2a9c1: write a version of three numbers, such as 0.4.0, into the files that state one warning A declared file states a version that isn't three numbers. Cutter files the release's issue.
…, and a later commit on trunk changed them, so Cutter releases nothing from 4f2a9c1: that commit's run decides notice The files on the branch's tip state another version than at the run's commit.
…, and trunk moved under every try to write them, so Cutter releases nothing from 4f2a9c1: a later run writes them notice Three pushes lost races.
…, and git push failed, so Cutter releases nothing from 4f2a9c1: a later run writes them warning git failed to push, and GitHub gave no refusal.
…, and GitHub refused the push to trunk: [remote rejected] (protected branch hook declined), so Cutter releases nothing from 4f2a9c1 warning GitHub refused the push, as for a rule of the branch's, or a declared file isn't a file at the tip. Cutter files the release's issue.
…, and ci.yml did not start there: GitHub answered 422 to POST /repos/acme/invoice/actions/workflows/ci.yml/dispatches; the next run on trunk tests 9c8b7a6 warning The version commit is on the branch, and GitHub refused to start your CI workflow there.
the workflow files on release/1.0 differ from those on the default branch, and GitHub refuses the run's token a push there, so Cutter writes no version files there and releases nothing: give the release workflow a GitHub App with the app-id input and the app-private-key secret notice The push needs the App, and you gave none. Cutter files an issue: Issues for a person.

… stands for the start of the first message, up to 0.3.2. A run for a branch that can't fetch the branch with git stops with git fetch failed; run the release job again, or with GitHub's refusal of the fetch, as a failed request to GitHub does.

Carrying fixes to release lines

Not in v0.6.2 or earlier: setdef/Cutter#87. v0.6.2 and earlier carry every fix onto every line whose branch exists, and cut a line's branch when a newer minor version releases.

From 1.0.0 on, each fix that releases from trunk reaches the people who use an older minor version too, on the lines your backport policy keeps living. Cutter cherry-picks it onto each such line, the line's CI tests it, and the line's passing run releases the patch, as Releasing a commit with no tag pushed describes. Nobody cuts a branch, cherry-picks, or pushes a tag.

  • A fix is a commit on trunk that adds entries under ### Fixed or ### Security in ## [Unreleased], and none under another heading or marked **Breaking:**. A commit that adds a feature with its fix isn't carried, since a line releases patches alone. A commit that only rewords an entry adds none, so it isn't carried. Cutter compares the entries of a commit's changelog with its first parent's as it does for a release's new entries, so an entry reworded where it stood is no added one, and neither is one added in the same stretch of lines that rewords another, where Cutter can't tell which is new. Cherry-pick such a fix onto the line yourself, with git cherry-pick -x. A fix that adds entries under ### Security alone is a security fix, one that adds entries under ### Fixed alone is a fixed one, and one that adds entries under both goes to the lines that either kind's rules name.
  • A release line is a minor version from 1.0.0 on, such as 1.0, below the minor version of trunk's newest release, that has a tag. Its branch is release/1.0, or for a package of the packages input, the package's tag prefix and then release/1.0, such as invoice/release/1.0. A package's lines are judged among that package's tags alone.
  • A living line is one that your backport policy names for at least one kind of fix: The backport policy.

The backport policy

Not in v0.6.2 or earlier: setdef/Cutter#87.

The backports setting of the settings file says which lines live, for each kind of fix apart, since a project may carry security fixes further back than other fixes. This policy carries a fixed fix onto the newest line, and a security fix onto the newest line of each of the two newest major versions and onto every line released within the last year, and ends release/1.0 after June 30, 2027:

backports:
  fixed:
    - newest-minors: 1
  security:
    - newest-majors: 2
    - released-within-days: 365
  end-of-life:
    release/1.0: "2027-06-30"
Key What it holds
fixed The rules that name the lines a fixed fix goes to: a list of mappings, each of one rule. A line lives for the kind when any rule names it. Left out, takes the default, [{newest-minors: 1}]. Empty, [], carries fixed fixes nowhere.
security The same, for security fixes. Left out, takes the default, [{newest-majors: 2}].
end-of-life For each line, by its branch, such as release/1.0 or invoice/release/1.0, the last day on which it takes a fix of either kind, written YYYY-MM-DD in quotes, in UTC. From the next day on, the line takes no fix, whatever the rules name. A branch of no line of your project caps nothing.

Each rule takes a whole number above 0 as its N:

Rule The lines it names
newest-minors: N The newest N lines. With trunk's newest release at 2.3.0, and lines 2.2, 2.1, 2.0, 1.4, and 1.3, newest-minors: 2 names 2.2 and 2.1.
newest-majors: N The newest line of each of the newest N major versions. With the same lines, newest-majors: 2 names 2.2 and 1.4.
released-within-days: N Each line whose first version, X.Y.0, GitHub published a release of within N days of the run. A line whose X.Y.0 has no published release, as when its run stopped, is named by no such rule.

Cutter works out which lines live from the policy and your tags in each run that carries, and stores nothing.

The default policy

Not in v0.9.3 or earlier: setdef/Cutter#105.

With no backports setting, or no settings file, Cutter follows the default policy: a fixed fix goes to the newest line, and a security fix to the newest line of each of the two newest major versions, with no end-of-life date. It is this policy:

backports:
  fixed:
    - newest-minors: 1
  security:
    - newest-majors: 2

With trunk's newest release at 2.3.0, and lines 2.2, 2.1, 2.0, 1.4, and 1.3, a fixed fix goes to 2.2, and a security fix to 2.2 and 1.4. Older lines take fixes only where your own backports setting names them. A fix still reaches a line only where it applies and the line's CI passes, and a project below 1.0.0 has no line to carry onto.

A backports setting that leaves out fixed or security gives that kind its default rules, so a file that holds only end-of-life, or only security, keeps the default for the kind it leaves out, and end-of-life caps the default rules as it caps yours. To carry a kind nowhere, give it an empty list. This turns carrying off:

backports:
  fixed: []
  security: []

There is no other way to turn it off.

When a line begins and ends

A line's branch is cut when the line first takes a fix. When a run publishes a release from trunk, and a living line with no branch lacks a fix of a kind it takes, Cutter cherry-picks the fixes onto the line's newest tag, such as v1.1.2, and pushes them as the new branch release/1.1, then starts your CI workflow there, whose passing run releases the patch. A living line that lacks no fix it takes gets no branch. A branch that exists already, as one you cut yourself, is the line's, as it is.

The policy retires a line: once no rule names it, or after its end-of-life date, Cutter carries nothing more onto it, whether or not its branch exists, and closes the line's open issue, such as one that 0.6.2 filed titled `release/1.1` was not cut, and fixes for it wait for you. For a retired line whose branch exists, the summary says release/1.0 takes no fix, since the backport policy keeps it living for neither kind. A branch with no tag of its minor version, such as release/1.5 with no v1.5.0 or later patch, is no line, since lines come from your tags: Cutter carries nothing onto it, says nothing of it, and closes an open issue for it. Deleting a branch retires nothing: a line the policy keeps living gets its branch back, cut from its newest tag, when it next takes a fix. Delete a retired line's branch when nobody needs it; its tags stay.

Which runs carry

Two kinds of run of the release job carry fixes, after the record step:

The run What it carries
One that published a release from trunk, whether for a tag you pushed or with no tag pushed That release's fixes, onto every living line below it, each of a kind the line takes, cutting the branch of a line that has none.
A run for a line's branch whose other jobs all passed, on the line's tip Every fix the line lacks of trunk's newest release, of a kind it takes, onto that line, while the policy keeps it living.

A line lacks each fix on trunk since its branch began, or since its newest tag when it has no branch, up to trunk's newest release, whose SHA is in no line (cherry picked from commit SHA) of a commit on the line, as git cherry-pick -x writes it. A fix that a person cherry-picked onto the line with -x counts as carried, and so does one the build cop reverted there. A fix that trunk itself reverted before the release isn't carried, since trunk's release no longer has its change. The fix's SHA is in a line This reverts commit SHA. in the message of a commit of the release. When trunk applies the fix again, as by reverting the revert, the commit that does so is the fix.

For each line with a branch, the run looks at the CI run on the line's tip first. A line with no branch has no such run, so Cutter carries onto its newest tag as onto a tip that passed:

The CI run on the line's tip What Cutter does
Passed Carries every fix the line lacks, oldest first, in one push.
Hasn't ended Nothing. That run carries once it passes.
None Starts your CI workflow on the line, whose run carries once it passes.
Failed, and the tip is a fix Cutter carried Nothing more. It waits for the build cop to revert that fix, as the next section describes.
Failed, and the tip reverts a fix Cutter carried, with another fix Cutter carried left above the line's last passing run Nothing. The build cop reverts the fix that is left, and the next CI run on the tip tells.
Failed for any other cause, or the tip reverts a fix Cutter carried and no other is left above the line's last passing run Nothing, and starts no CI run there: the line is broken.

In the line's own run, another job of the run that ended without passing means the tip failed. Cutter carries nothing, files no issue, and the summary says release/1.0 carries nothing from its CI run on 3d9e0f2, whose other jobs didn't pass. The build cop reverts a red line's fix, and a red line's issue is the line's own concern.

What a carried fix looks like

Each fix is a commit on the line with the fix's message and a last line (cherry picked from commit SHA) that holds the SHA of the commit on trunk. Its author is the fix's, and github-actions[bot] commits it. Its changelog is the line's, with the fix's entries added under their headings in ## [Unreleased], and every other section as it was. The line's CI run then calls for a patch, such as v1.0.4, and its passing run releases it.

Cutter skips a fix on a line, and says so in the summary, when its cherry-pick conflicts in a file other than the changelog, when the line has its change already, or when the line's changelog has no ## [Unreleased] heading, isn't a file, or isn't UTF-8. Each later run that carries onto the line tries the fix again. To keep a fix off a line for good, cherry-pick it there with -x and revert it.

When a carried fix fails the line's CI

Cutter pushes carried fixes onto the line itself, and the line's CI tests them. When that run fails, the build cop handles it as any red run: it runs the failed jobs again, finds the fix that fails, and reverts it. The reverted fix keeps its (cherry picked from commit SHA) line on the branch, so Cutter doesn't carry it there again, and the next fixes follow once the line's CI passes.

That needs the build cop to guard the line with revert: true. Its branches input guards release/* by default, and a package's lines need their pattern in it, such as invoice/release/*. On a line that the build cop doesn't guard, a failed fix stays on the tip, Cutter carries nothing more there, and an issue titled `release/1.0` waits for a revert of a fix says to revert it with git revert.

A broken line

A line whose tip's CI run failed for a cause of its own, such as a tool its build downloads that is gone, gets no fix, and Cutter spends no CI run on it. So does a line whose tip reverts a fix Cutter carried and whose CI run on that tip failed, when no fix Cutter carried is left above the line's last passing run for the build cop to revert: the revert put the line back as it was, and it still fails. An issue titled `release/1.0` is red, and fixes wait for it says so. Put the line right with a commit of your own: its passing run carries every fix the line lacks, in order, and closes the issue. Or retire the line, with an end-of-life date in the backport policy.

When GitHub refuses the push

A rule on release/* that blocks github-actions[bot], a token that may not push, and a GitHub App that isn't installed on your repository make GitHub refuse the push of carried fixes in every run. When GitHub refuses the push in one of these ways, or refuses to make the App's token, Cutter carries nothing more onto the line, and files an issue titled `release/1.0` can't take carried fixes, and they wait for you, which gives GitHub's answer. Put what GitHub refused right: the line's next passing run carries every fix it lacks, in order, and closes the issue. A push that fails for a cause a later run may not meet, as another push that came first, a failed connection, or a 5xx status, only warns, as does a rate limit on making the App's token, and a later run carries the fixes.

When GitHub refuses the fetch

Cutter fetches trunk's commits that a line lacks with git. When GitHub refuses that fetch with a status of 401, 403, or 404, as it does for a token that may not read your repository, as when the job that calls the release workflow grants no contents permission, every run is refused the same way. Cutter carries nothing onto the line, and files an issue titled `release/1.0` can't be read, and fixes wait for you, which gives GitHub's answer. Put what GitHub refused right: the line's next passing run carries every fix it lacks, in order, and closes the issue. A fetch that fails for another cause, such as a 5xx status, a timeout, or a failed connection, only warns, and a later run carries the fixes.

Git tells Cutter the status of a fetch and nothing else of GitHub's answer, so Cutter can't tell a 403 that is a rate limit from a refusal of your setup. A fetch that GitHub answers with such a 403 files the issue too, and the line's next passing run, once its fetch gets past, closes it. The record step's fetch is read the same way, and files the release's issue.

Workflow files that differ

GitHub refuses the run's token a push to a line whose workflow files differ from your default branch's, as a line's do once trunk changes a workflow file since the line began, the push that cuts a line's branch at such a commit included. There Cutter pushes, and cuts, with the token of your GitHub App, after which GitHub starts the workflows that run on a push. Without an App, it carries nothing onto such a line, and cuts no such branch, and says so in a notice and in an issue titled `release/1.0` needs a GitHub App, and fixes wait for it; a line's runs can't release there without one either.

What the summary says

Each line the run looks at gets a line of the summary, such as:

Carried 7c1e5ab and 9d2f3b1 onto release/1.2 in 3d9e0f2, and started ci.yml there.
Cutter skipped on release/1.1 7c1e5ab, since its cherry-pick conflicts in lib/invoice/total.rb.
release/1.1 lacks no fix of the kinds it takes, released from trunk up to v1.3.0.
Cut release/2.0 from v2.0.4 with 9d2f3b1 carried onto it in 4e1a7c3, and started ci.yml there.
release/1.0 takes no fix, since the backport policy keeps it living for neither kind.

Inputs

Input Type Default What it is
artifact string empty The name of the artifact that the calling run uploads with the files a release publishes. Empty publishes no files, and no SHA256SUMS: artifact.
title string your repository's name The start of each release's title. The release of v0.4.0 is titled TITLE 0.4.0. A package's release is titled with its tag prefix instead: packages. Deprecated: give title in the settings file instead.
changelog string CHANGELOG.md The path of your changelog, from the repository's root. With the packages input, each package's line gives its changelog instead. Deprecated: give changelog in the settings file instead.
record-command string empty A shell command that the record step runs after it dates the changelog, to raise the version in your version files. Empty runs no command. Deprecated: version-files keeps your version files in step before the tag.
packages string empty The packages of a repository that holds several, each released apart from the others, one line each: packages. Empty releases the repository as one project. Deprecated: give packages in the settings file instead.
release-without-tag boolean true Whether a run for trunk or a release branch releases the commit it is for: release-without-tag. Deprecated: give release-without-tag in the settings file instead.
app-id string empty The ID, or client ID, of the GitHub App that tags a commit, or moves stable, when the run's token can't, as A GitHub App describes. Empty means no App.
app-environment string empty The name of the environment of your repository that holds the app-private-key secret, which the release job names, as A GitHub App describes. Empty means none.

The workflow takes one secret, app-private-key, which may be left out: the private key of the App whose ID app-id holds, as A GitHub App describes.

When your repository has the file .config/cutter.yml, and the file holds at least one of title, changelog, record-command, packages, and release-without-tag, the run reads those five settings from it, and none of those five inputs: The settings file. The five inputs, and record-command wherever it is given, are deprecated: Deprecated settings.

The settings file

.config/cutter.yml, at your repository's root, holds five of the inputs in one place that the release workflow and the version workflow both read, so you give none of them twice. Its keys are the inputs' names: changelog, packages, record-command, title, and release-without-tag. Each key takes what its input takes, by the input's rules, except packages, which is a list of mappings, each with the keys prefix and changelog, in place of the input's lines. The settings of the example in packages are:

packages:
  - prefix: invoice/
    changelog: gems/invoice/CHANGELOG.md
  - prefix: receipt/
    changelog: gems/receipt/CHANGELOG.md

Each step of each run reads the file through GitHub's API, at the commit the run is for, before anything else it asks GitHub. When the commit has the file, and the file holds at least one of the five keys:

  • Cutter takes all five settings from the file, and ignores those five inputs, whatever you give them. GitHub hands a called workflow an input's default when the caller gives none, so Cutter can't tell an input you gave from its default, and says nothing of one.
  • A key the file leaves out takes the default in Inputs, not the input's value. A file that holds only title: Invoice releases the repository as one project, with CHANGELOG.md, no record command, the title Invoice, and release-without-tag true.
  • The version workflow's record holds the file's changelog and packages, so the release job compares what the two read as it compares their inputs.

Without the file, or with a file that holds none of the five keys, such as one that holds only a build-cop key, the five inputs work as Inputs says. Cutter can't tell an input you gave from its default for one key, but a file with none of the five keys says nothing of these workflows, so it takes the inputs then, and a project that moved only its build cop settings into the file keeps reading the changelog and packages it gave in with:. artifact, app-id, app-environment, and the secret stay inputs, since GitHub reads them before any step runs.

The file may also hold the build cop's settings under a build-cop key. The release and version workflows read none of them, and refuse a build-cop key that the build cop couldn't use. A file that holds only that key leaves these workflows on their inputs.

The file also lists the files that state your project's version, under a version-files key, which no input gives, and which is read whichever of the file and the inputs gives the other settings: Version files. Not in v0.9.1 or earlier: setdef/Cutter#98.

The file also holds the backport policy, under a backports key, which no input gives. The release job's carry step reads it whichever of the file and the inputs gives the other settings, so a file that holds only a backports key gives the policy and leaves the five settings to the inputs. Not in v0.6.2 or earlier: setdef/Cutter#87.

Cutter can't use a file:

  • over 64 KiB, which it refuses before it parses it;
  • that isn't YAML, such as one with a syntax error;
  • that Ruby's YAML reader, Psych, refuses when it loads it safely: an alias, a value it would make an object of, such as the date 2027-06-30 or the symbol :invoice (put the value in quotes to make it a string), or nesting too deep for it;
  • whose document is no mapping, as an empty file's is, or with a key that is no setting, a value of the wrong type, a changelog path that is empty or has an empty part, ., or .., a tag prefix the packages input would refuse, or two packages with one prefix;
  • with a version file that has no path, a kind Cutter doesn't know, a kind beside its own before, after, or below, no kind and no before or after, a text with a line break, or an empty below, or with version-files at the top level beside packages: Declarations;
  • with a backport rule that is no mapping of exactly one of newest-minors, newest-majors, and released-within-days, a rule's N that is no whole number above 0, an end-of-life key that is no line's branch, such as release/1.0 or invoice/release/1.0, with a minor version from 1.0 on, or an end-of-life date that is no real day written YYYY-MM-DD.

Cutter stops every run for such a file, a run for a branch it previews nothing on included, as it does for a packages input it can't read, and files no issue. The message gives the key's path, or Psych's words for what it found, with a line and a column for a syntax error, such as Cutter can't use .config/cutter.yml at 4f2a9c1: packages[0].prefix has no letter or digit to title its releases with. A key longer than 64 characters, which no setting has, is named by its first 64, in quotes and followed by ....

Note

Cutter reads the file as Psych reads YAML, which follows YAML 1.1, and an editor that checks it against the schema follows YAML 1.2, so the two read some plain values differently, such as yes, no, on, off, and 1:30 (true, false, and 5400 in YAML 1.1, strings in YAML 1.2) and 0o17 and 1e3 (strings in YAML 1.1, numbers in YAML 1.2): put such a value in quotes to give both the same string. Cutter takes what Psych gives, so a file with several documents gives its first, a key given twice gives its last value, and a merge key << merges.

Cutter publishes a JSON Schema of the file, schema/cutter.schema.json, JSON Schema draft 2020-12, beside its workflows, so that an editor completes and checks the file. Point your editor at the schema at the commit of Cutter you pin, whose raw address is https://raw.githubusercontent.com/setdef/Cutter/, that commit's full SHA, and /schema/cutter.schema.json. The schema can't say that two packages may not share a prefix, so only Cutter refuses that.

Deprecated settings

Not in v0.9.2 or earlier: setdef/Cutter#104.

A later major version of Cutter will remove two ways to configure the release and version workflows. Until then, both work as they did, and a run says so in a notice.

Deprecated Replaced by
The changelog, packages, record-command, title, and release-without-tag inputs of the release workflow, and the changelog and packages inputs of the version workflow The key of the same name in the settings file, which both workflows read, so you give each setting once. cutter init writes the file from your workflows' inputs, and lists the inputs to delete: Set up a project with cutter init.
record-command, as an input or as a key of the settings file version-files in the settings file, which writes your project's version into the files that state it, in a commit before the tag, with no command to run: Version files.

The release step writes the notices, in a run for a tag and in a run for a branch alike, once it has read the settings, and writes them to the summary and to the log, as The log of a run says. The version, record, and carry steps write none, so a run says each once, whatever workflows it calls.

Message Kind Cause
The changelog, packages, record-command, title, and release-without-tag inputs are deprecated, and a later major version of Cutter will remove them. `cutter init` moves them into .config/cutter.yml, which the release and version workflows both read: https://github.com/setdef/Cutter/blob/trunk/docs/reference/release.md#the-settings-file notice The settings come from the inputs, and you gave at least one of the five a value other than its default.
record-command is deprecated, and a later major version of Cutter will remove it. version-files in .config/cutter.yml keeps your version files in step before the tag: https://github.com/setdef/Cutter/blob/trunk/docs/reference/release.md#version-files notice The record command isn't empty, whether it comes from the input or from the settings file.

GitHub hands a called workflow an input's default when the caller gives none, so Cutter can't tell an input you gave from its default, and a default says nothing: release-without-tag: true, changelog: CHANGELOG.md, and an empty title, packages, or record-command give no notice. When the settings file holds any of the five keys, Cutter ignores the inputs and gives no notice of them. A run that gives both notices writes the first of the two above, then the second.

The notices change nothing else. A run with a deprecated setting releases what it released before, and neither notice is a warning or a failure.

artifact

With the input left out, or empty, a release publishes its notes and no files, and writes no SHA256SUMS, since a file of the checksums of no files would list nothing. The release job downloads no artifact, so your CI workflow needs no job that uploads one, and no step of Cutter checks for one. Leave it out for a project that people install straight from its git tag, which builds nothing to publish: GitHub attaches the tagged tree to every release as its source code archives. Every other step goes as it does with an artifact.

Naming an artifact that this run didn't upload, or that holds no file, still stops the run, since naming an artifact and uploading nothing is a mistake: this run uploaded no artifact named release. To publish no files, leave the input out.

With an artifact named, every file in the artifact is published under its file name, whether it sits at the artifact's top level or in a folder. Two files with one name in different folders stop the run, and so does a name with a newline or a backslash. A file named SHA256SUMS in the artifact stops the run too, since Cutter writes that one. So does a symbolic link, since it could point outside the artifact's folder: upload the file itself.

The calling run uploads the artifact with actions/upload-artifact, in a job the release job needs. That job builds your project with the version the version workflow names, which on a tag run is the tag's: Publish what your CI builds.

record-command

Deprecated: a later major version of Cutter will remove record-command, as an input and as a key of the settings file. version-files keeps your version files in step before the tag, with no command, and a run that has a record command says so in a notice: Deprecated settings.

The command runs with bash, in a checkout of the branch the release is recorded on, with these variables set:

Variable Holds
CUTTER_VERSION The released version, such as 0.4.0.
CUTTER_PREVIOUS_VERSION The version of the release before it on that branch, or empty for the first release.
CUTTER_CHANGELOG The path of the changelog the release is recorded in. For a repository's one project, the changelog input's path, such as CHANGELOG.md. For a package, the path its line gives, such as gems/invoice/CHANGELOG.md.
CUTTER_TAG_PREFIX For a package's release, its tag prefix, such as invoice/. Not set for a repository's one project.

Any other variable whose name starts with CUTTER_ is Cutter's own, and may change in any release.

The command also sees the environment that GitHub gives the record step, such as GITHUB_REF_NAME and GITHUB_SHA. In a run for a branch that finishes a release, those name the run's branch and commit, not the release's tag and its commit, so read the release's version from CUTTER_VERSION. Neither the run's token nor a GitHub App's key is in it: Cutter reads both from standard input, and leaves them out of the environment.

Whatever files the command changes go into the record commit with the changelog. A command that exits with a status other than 0 stops the record, and the release stays published. The record step then warns and succeeds, and a later run runs the command again, as Why a run stops says. For a gem whose version lives in lib/invoice/version.rb and Gemfile.lock:

    with:
      artifact: release
      record-command: |
        sed -i "s/VERSION = \".*\"/VERSION = \"$CUTTER_VERSION\"/" lib/invoice/version.rb
        sed -i "s/^    invoice ([^)]*)/    invoice ($CUTTER_VERSION)/" Gemfile.lock

The command runs on the record step's runner. It's your code, in your repository: write it as you would any other step.

release-without-tag

Deprecated as an input: give release-without-tag in the settings file. The key takes true or false as the input does.

With true, the default, a run for trunk or a release branch releases the commit it is for when its changelog lists something new, as Releasing a commit with no tag pushed describes. With false, such a run only previews, and you release by pushing a tag, as before. A tag you push releases through the run for that tag either way.

    with:
      artifact: release
      release-without-tag: false

packages

Deprecated as an input: give packages in the settings file, as a list of mappings with the keys prefix and changelog, and each package's version-files beside them. The lines below are the input's form.

Each line gives one package: its tag prefix, one or more spaces, and the path of its changelog from the repository's root. Blank lines, and spaces at the start and end of a line, don't count. A tag prefix holds letters, digits, ., _, -, and @, in parts between slashes, none of which starts with a period, such as invoice/, invoice-, or gems/invoice/, and at least one of them is a letter or a digit, since each of the package's releases is titled with its prefix. A changelog's path may hold spaces.

For a repository of two gems, gems/invoice/ and gems/receipt/, each with its changelog and its version file:

    with:
      artifact: release
      packages: |
        invoice/ gems/invoice/CHANGELOG.md
        receipt/ gems/receipt/CHANGELOG.md

With the input set, each release is of one package, the one whose tag prefix the tag starts with, and the longest such prefix when several match. Another package's tags count for nothing: receipt/v1.2.0 says nothing of the last release of invoice, so two packages at one commit can release different versions, or one can release and the other not.

What A package's release A repository's one project
The tag The prefix, v, and a version: invoice/v0.4.0 v and a version: v0.4.0
The version From the package's changelog and its last tag From changelog and the last v tag
The title The prefix without the characters at its end that aren't letters or digits, and the version: invoice 0.4.0 title, or the repository's name, and the version
The changelog that the notes come from and the record dates The one its line gives changelog
The branches it releases from trunk, and for a patch from 1.0.0 on, the package's release branch: invoice/release/X.Y trunk, and from 1.0.0 on, release/X.Y
The record-command's CUTTER_VERSION, CUTTER_PREVIOUS_VERSION, and CUTTER_CHANGELOG The package's versions, and the path its line gives The versions, and the changelog input's path
The record-command's CUTTER_TAG_PREFIX The package's tag prefix Not set

A tag that starts with no package's prefix, such as v0.4.0, stops the run, and so does an input that gives a prefix twice, a line with no changelog, or a prefix with no letter or digit, on every run. With the input set, Cutter reads neither title nor changelog.

One job calls the release workflow for every package, so the run has one release job, whichever package its tag is of, and the check that every other job passed works as for one project. Your CI workflow runs for each package's tags, and on a tag run builds the package whose prefix the tag starts with: Release one package of several.

A GitHub App

GitHub refuses the run's token a branch, or a tag, at a commit whose workflow files differ from those on your default branch, so the run's token can't move stable to such a release. Nor can it tag such a commit for a release with no tag pushed, as it can't on a release branch whose workflow files have fallen behind trunk's, or push a version commit onto such a branch. For these, give the release workflow a GitHub App installed on your repository, with the repository permissions Contents and Workflows, both read and write. It can be the App you give the build cop.

Name Kind What it is
app-id input, string The App's ID, or its client ID. Empty, the default, means no App.
app-private-key secret The App's private key: the whole PEM file GitHub gave you for it.
app-environment input, string The name of the environment that holds the key, which the release job names. Empty, the default, means none.

The record step reads the key, and mints a token from the App only when it moves stable to a release whose workflow files differ from your default branch's: one token, for your repository alone, with Contents and Workflows write. The release step reads the key too, and mints such a token only when a run for a branch tags a commit whose workflow files differ from your default branch's, or pushes a version commit onto a branch other than your default branch whose tip's workflow files differ from it; it makes the tag's object with the run's token and its reference with the App's. As soon as either step mints the token, it writes the workflow command ::add-mask:: and the token to standard output, so that GitHub's runner hides the token in the rest of the job's log. The token expires an hour after it is minted. Every other request and push of the release uses the run's token, and a run that needs no such tag or move mints nothing.

The carry step reads the key too, and mints such a token only when it pushes fixes onto a release line, or cuts a line's branch, where the workflow files differ from your default branch's, or a carried fix changes one: Workflow files that differ.

When the move needs the App, the record step moves nothing and says why, once the release is recorded, if you gave app-id without app-private-key, app-private-key without app-id, or a key that is no RSA private key in PEM form. When GitHub refuses to mint the token, as it does for an App that isn't installed on your repository, the move stops with GitHub's status and the request it refused. Either way, stable stays where it is, and the release stays published and recorded.

With the key in an environment, only the jobs that name that environment can read it. The release job names the environment that app-environment holds in every run, with the option deployment: false, as the build cop's job does, so GitHub creates no deployment for it. Pass the secret by name, which works even when the secret exists only in that environment:

    with:
      artifact: release
      app-id: ${{ vars.RELEASE_APP_ID }}
      app-environment: release
    secrets:
      app-private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

The environment's rules apply to every run of the release job, a run for a branch included, as Keep the key in an environment describes for the build cop. A required reviewer or a wait timer holds each run of the job, so leave both off. A deployment branch or tag rule is matched against the ref of the run, so it has to allow trunk, your release/X.Y branches, and your version tags. A custom deployment protection rule fails the job.

With the App's key, anyone who obtains it can push to your repository and change its workflows: Tokens and permissions.

Outputs

Output Holds
commit The full SHA of the commit the run released, or would release.
version The version, such as 0.4.0.
tag v plus the version, or a package's tag prefix, v, and the version, such as invoice/v0.4.0.
published true when this run published a release, whether for a tag you pushed or for a commit it tagged, and false otherwise, as for a run that only records a release published before it.
record true when the run goes on to record a release, whether this run published it or found it published and not recorded, and false otherwise. Also true when the run found the release published and recorded, and goes on only to move stable to it. Also true when a run for a branch goes on to finish a release published before its commit.

A run on a branch whose changelog lists nothing new, or can't be read, or calls for a version that a tag on the commit couldn't release, sets commit, version, and tag to empty. So does a run for a branch that Cutter previews nothing on, which sets no output but published and record, so a job that reads the other three gets empty strings. So does a run on a branch with two or more packages in the packages input, since one output can't hold the release of each; with one package, they hold its release. On a package's release branch, they hold that package's release. A project installed from its git tag lists its version files instead, which Cutter writes before it releases: Version files.

A run for a branch that goes on to finish a release published before its commit still sets commit, version, and tag to what the commit would release as, not to that release. A run for a branch that releases the commit it is for sets them to that release.

The summary of a run on a branch

The run's summary has one line, in one of four forms:

The changelog The summary says
Lists something new, for a version a tag on the commit can release 4f2a9c1 would release as v0.4.0: CHANGELOG.md lists 3 new entries under Unreleased, one of them under Added, one under Changed, and one under Fixed. With one entry, it says CHANGELOG.md lists 1 new entry under Unreleased, under Added. With every entry under one heading, 2 new entries under Unreleased, both under Fixed, or 3 new entries under Unreleased, all under Fixed.
Lists something new, for a version a tag on the commit can't release 4f2a9c1 can't release as v1.1.0: it is on no branch Cutter releases from. The reason is one of two. the tag v1.0.1 exists already says that the repository has a tag of that version on another commit. it is on no branch Cutter releases from says that the commit is on no branch that step 3 lets a tag of that version be released from. For a package, the reason is it is on neither trunk nor invoice/release/1.0 for a patch from 1.0.0 on, and it is not on trunk, and Cutter releases a package's tag from a release branch only for a patch from 1.0.0 on for any other version. The run doesn't fail and writes no warning, and sets commit, version, and tag to empty.
Lists nothing new Nothing to release: CHANGELOG.md at 4f2a9c1 lists nothing new since v0.3.2. With no release before it, lists nothing under ## [Unreleased] ends the line.
Lists an entry Cutter can't tell from one of the release before's, reworded or moved The line for something new that a tag can release, or for nothing new, followed in the same line by Cutter can't tell whether "Update dependencies." in CHANGELOG.md at 4f2a9c1 is a new entry or one of v0.3.2's reworded or moved, so it counts it as v0.3.2's.
Can't be read Cutter can't tell what 4f2a9c1 would release as: CHANGELOG.md at 4f2a9c1 does not exist; set the changelog input to your changelog's path. The run also writes the same problem as a warning, and doesn't fail: a change that no one asked to release shouldn't turn your trunk red. The problem is one of the changelog's, which Why a run stops lists.

The count is of the entries a release of the commit would list: the ones that the published release before it didn't, as step 5 counts what's new.

A tag on the commit can release a version when the repository has no tag of it on another commit, and the commit is on a branch that step 3 lets a tag of that version be released from. Two cases make a run say otherwise:

  • On release/1.0, an entry under ### Added calls for v1.1.0. A release branch releases only patches of its own major and minor numbers, so a tag of v1.1.0 there stops with on no branch Cutter releases from. The same holds for a release/0.Y branch, which releases no tag.
  • After v1.0.1 is released from release/1.0, a commit on trunk whose only change since v1.0.0 is that fix calls for v1.0.1 again. Trunk's history doesn't hold the tag, which is on the release branch, and GitHub refuses a push of a tag that exists.

A tag of the version on the commit itself doesn't count against it: a run for that tag releases the commit.

With the packages input, the summary has one such line for each package, in the input's order, and a warning for each changelog that can't be read:

4f2a9c1 would release as invoice/v0.4.0: gems/invoice/CHANGELOG.md lists 2 new entries under Unreleased, one of them under Added and one under Changed.
4f2a9c1 would release as receipt/v1.3.0: gems/receipt/CHANGELOG.md lists 1 new entry under Unreleased, under Added.

A run for a package's release branch, such as invoice/release/1.0, has the line of that package alone, and the outputs hold its release, as for a one-package input.

The log of a run

GitHub shows a run's summary only on the run's page: gh run view --log and the REST API don't give it. So the release step writes each line it adds to the summary to the job's log too, on standard output, as plain text, in the same order and with the same words. A script outside the run reads the log of the release job and finds the lines there. With the packages input, there is one for each package:

4f2a9c1 would release as invoice/v0.4.0: gems/invoice/CHANGELOG.md lists 2 new entries under Unreleased, one of them under Added and one under Changed.
4f2a9c1 would release as receipt/v1.3.0: gems/receipt/CHANGELOG.md lists 1 new entry under Unreleased, under Added.

A run for a tag writes its lines to the log too, such as Published the release v0.4.0 of 4f2a9c1e0b7d3a5c8f6e2d1b9a0c7e5f3d2b1a09., so a script reads the same text the summary shows, whichever ref the run is for. The log has no more of the summary than the release step writes: the record step and the carry step, which are steps of the same job, write their summary lines to the summary alone.

The log shows a line as written, where the summary shows it as Markdown. A notice's text is in the log twice: once as GitHub shows the annotation, and once as the line of the summary. Match a line by its words, such as would release as, and not by its place in the log.

A line that holds a name from your repository could start a workflow command, which GitHub's runner reads from any line of the log that starts with :: after any whitespace, or holds ##[. Cutter writes such a line between ::stop-commands:: and the line that resumes commands, with a token that it makes for that line alone, so the runner reads nothing in the line as a command. Those two lines are in the log, and the token is a random 32-character string. Every other line has no such lines around it.

Finishing a release on a later run

A release that GitHub has published stays published whatever its record step does, and the record step can stop, as Why a run stops lists. A run for trunk or a release/X.Y branch then finishes the work, so that nobody has to run the release job again. After it writes its summary line, it looks at the newest release that GitHub has published of a tag before its commit, and goes on to the record step for it when either of these holds:

  • Trunk's changelog has no ## [X.Y.Z] heading for its version.
  • From 1.0.0 on, stable doesn't point at it, and GitHub has published no release of a higher version.

The record step then does what it does in a run for the release's tag: it writes the record commit on the branch the tag is on, with your record-command, and on trunk for a tag on a release/X.Y branch, starts your CI workflow on each branch it pushed to, and moves stable. The run publishes nothing, sets published to false and record to true, and adds a line to its summary:

GitHub has published v0.4.0 of 4f2a9c1e0b7d3a5c8f6e2d1b9a0c7e5f3d2b1a09, and trunk's changelog has no ## [0.4.0] heading yet, so Cutter records the release.

With the packages input, the run looks at each package it previews, in the input's order, and finishes the first package's release that needs it. A later run finishes the next one.

Limits to know:

  • One release in each run. A run looks only at the newest published release before its commit. When an older release's record stopped too, and a newer one is recorded, run the older tag's release job again to record it.
  • The tagged commit. A tag on the commit a run is for comes before that commit in no history, so the run for trunk at the tagged commit leaves the release to the run for its tag. The next commit's run finishes it.
  • A changelog Cutter can't read. When trunk's changelog has a problem that Why a run stops lists for a changelog, such as no ## [Unreleased] heading, the run goes on to nothing.
  • stable without an App. When the workflow files at the release differ from your default branch's and you gave no GitHub App, stable stays behind the release, and each run for trunk goes on to the record step and warns that it stays, until you move stable yourself or a higher release moves it.
  • The date. The record step dates the heading with the day it runs, in UTC, so a release recorded by a later run is dated that day.
  • A release you made before Cutter. A run for trunk records the newest release GitHub has published before the commit when trunk's changelog has no heading for it, whoever published the release. Before your first run that calls the release workflow, check that your changelog has a ## [X.Y.Z] heading for your newest release.

A run for trunk and the run for a tag can record the same release at once. Cutter looks for the heading again before each try, and pushes without force, so one record commit lands, and the other run finds the heading and writes nothing.

A run for another branch

A run for a branch other than trunk, a release/X.Y branch, and, with the packages input, a package's release branch, publishes nothing and previews nothing, and it succeeds. It writes one line as a notice and in the run's summary, and asks GitHub for nothing but the settings file:

Cutter previews nothing for the branch bisect/4f2a9c1, since it previews only trunk or a release/X.Y branch.

With the packages input, the line lists each package's release branch too, as in since it previews only trunk, a release/X.Y branch, invoice/release/X.Y, or receipt/release/X.Y. GitHub shows the notice as an annotation on the run's page. The run sets published and record to false, so a later job whose if: is needs.release.outputs.published == 'true' is skipped.

This is why the release job doesn't turn red for a branch that your CI runs on, such as a feature branch, or a bisect/ branch that the build cop makes for a trial. A run for a tag by any event but push, and a run for any event but push and workflow_dispatch, still stop: Why a run stops.

Permissions

Grant the calling job these three, and no others, in a permissions: key on that job. When the key lists any permission, GitHub sets every permission the key doesn't list to none, whatever your repository's or organization's default is: Default workflow permissions.

Permission Why
contents: write To create the release, upload its files, and push the record commit, to tag a commit it releases with no tag pushed, and to push the version commit. From 1.0.0 on, it also lets the release workflow move stable, cut a release line's branch, and push carried fixes onto it. A branch rule or ruleset on the branch has to let github-actions[bot] push: Let Cutter push to trunk.
actions: write To read this run's jobs, download its artifacts, and start your CI workflow on the record commit and the version commit, and on a release line after Cutter pushes to it.
issues: write To file, update, and close the issues in which Cutter says what a run left for you: Issues for a person. The release job asks for it, so a calling job that doesn't grant it can't start the job.

Cutter's jobs ask for no more than each needs: a run on a branch only reads, unless it releases the commit it is for, writes its version commit, or finishes a release published before its commit. A called workflow can't get more permissions than its caller grants, so a calling job that grants less stops at the first step that needs more.

The workflow uses the token GitHub gives each run. It also takes a GitHub App's token, minted from the optional app-private-key secret, for the steps GitHub refuses the run's token: A GitHub App. What each token can and can't do: Tokens and permissions.

The record commit

After the release is published, Cutter checks out the branch the tag is on, as that branch stands then, and writes one commit. A run for a tag whose release is published and has no ## [X.Y.Z] heading in that branch's changelog writes the same commit without publishing anything, so a record that stopped is made by running the job again. The commit holds:

  • In the changelog, or in a package's changelog alone, a ## [X.Y.Z] - YYYY-MM-DD heading, dated in UTC, with the release's notes: the entries new since the release before it, as step 5 counts them. Every entry the tagged commit listed leaves ## [Unreleased], reworded since or not, and entries added after the tagged commit stay there. An entry that Cutter can't tell from one of the release's reworded or moved leaves too, and the record step writes it in a warning and in the summary: add it again under ## [Unreleased] if it is new. At the foot of the changelog, the [Unreleased] link compares from this release's tag, and an [X.Y.Z] link goes to the release's page.
  • The changes your record-command makes.

When the branch's changelog already has a ## [X.Y.Z] heading for the version, with or without a date, Cutter writes no second one. It makes no commit there, starts no workflow there, and says on standard error that the branch already records the version. This is what a run finds when another run recorded the release first.

The commit's message is chore: record vX.Y.Z in the changelog, or for a package chore: record invoice/v0.4.0 in the changelog, and its author is github-actions[bot]. Cutter pushes it to the branch. When the push loses a race with another push, Cutter fetches the branch and writes the commit again, up to three times in all. Then it starts your CI workflow on the branch with workflow_dispatch, since a push made with the run's token starts no workflow.

When GitHub refuses to start your CI workflow, as it does for a workflow without a workflow_dispatch trigger, the record step writes a warning and a line of the summary that name the record commit, and succeeds. The record commit stays untested until the next run of your CI workflow on that branch, which tests it with the commits pushed after it.

For a tag on a release/X.Y branch, Cutter also adds the dated section to trunk's changelog, in a second commit with the same message, and runs no record-command there. Trunk's ## [Unreleased] keeps the fix's entry: the next release from trunk brings the fix to people on other versions, and its notes list it for them. The [Unreleased] link at the foot of trunk's changelog still compares from trunk's last release, and an [X.Y.Z] link to the release's page follows it. The dated section goes right after ## [Unreleased], so trunk's changelog lists releases newest first by date. Cutter records on the release branch first and on trunk after it, so a record that stops on the release branch pushes nothing to trunk. When your CI workflow doesn't start on the release branch, Cutter still records the release on trunk. The step then succeeds with a warning.

A package's tag on the package's release branch, such as invoice/v1.0.1 on invoice/release/1.0, is recorded the same way, in that package's changelog alone, on the release branch with the record-command, and then on trunk without it.

Moving stable

From 1.0.0 on, Cutter keeps the branch stable at the commit of your highest release, so that you can make it your repository's default branch: Release 1.0.0. A project whose default branch is stable needs a GitHub App for a run for a branch to release its commit, since after a change to a workflow file every commit on trunk differs from stable. Once the record step has recorded a release on every branch, it moves stable to the tagged commit when each of these holds:

  • The tag is v plus a version from 1.0.0 on. A package's release moves no stable.
  • GitHub has no published release of a higher version. A higher tag whose run stopped, and that GitHub has no release of, doesn't count.
  • stable doesn't point at the tagged commit already.

The first such release creates stable. Each later one moves it whether or not the tagged commit comes after the commit stable points at, since the highest release needn't descend from the one before it: a v2.0.0 from trunk moves stable there, and a later v1.4.1 from release/1.4 leaves it at v2.0.0. Moving stable is the one branch update that Cutter forces.

Which token moves it depends on the folder .github/workflows at the tagged commit, compared with the one at the tip of your default branch, where a file changed, added, or removed counts as a difference:

The workflow files at the tagged commit stable
Are the same as on your default branch Moves with the run's token.
Differ, and you gave a GitHub App Moves with the App's token.
Differ, and you gave no App Stays where it is. Cutter writes a warning, and a line in the summary, that say why, and the job succeeds, since the release is published and recorded.

When stable stays, you can move it yourself, as an account that may push workflow changes, with the tagged commit's SHA:

git push --force origin 4f2a9c1:refs/heads/stable

The summary says what Cutter did, as Moved stable from 1a0b0c0 to 4f2a9c1, the commit of v1.1.0., Created stable at 4f2a9c1, the commit of v1.0.0., or stable points at 4f2a9c1, the commit of v1.1.0, already.

When the move stops, as when GitHub refuses it, its message ends with ; a later run of the release job moves stable. The record step writes the message as a warning and in the summary, and succeeds. Running the job again passes steps 1 to 5, finds at step 6 the release published and recorded with stable behind it, and goes on to move stable, and so does the next run for trunk, as Finishing a release on a later run describes.

Issues for a person

A run that leaves work for a person files an issue in your repository, so that you hear of it without opening the run, and succeeds:

What the run left The issue Cutter closes it when
A run for a tag that a step before step 8 stops, or that a failed request to GitHub stops, as a 5xx or a timeout does, since no later run finishes the release of a tag; a run for a branch whose version commit a declared file holds back, or that GitHub refuses; a record that stops with a message that doesn't end with ; a later run of the release job records it; a record that loses every race to another push; and a record whose git fetch GitHub refuses with a status of 401, 403, or 404 One for each tag's release, titled Cutter can't finish the release of `v0.4.0` , with the tag's name as code so that it mentions nobody and links nothing. A run records the release on every branch, or a run for the tag finds it finished.
stable behind the highest release: without a GitHub App where the workflow files differ, with an App that has a problem, or with a move that GitHub refuses with a status of 4xx that asking again doesn't change, which leaves out 408, 429, and a 403 that GitHub gives for a rate limit One, titled Cutter can't move stable to the highest release. A run finds stable at the release. When you move stable yourself, the issue stays open until the record step of a release looks at stable again.
A run for a branch that isn't your default branch, and can't tag its commit, or push its version commit, because the workflow files differ from your default branch's and you gave no App. A run for your default branch files nothing for it, since the next commit's run releases the changes. One, titled Cutter can't release a commit whose workflow files differ from the default branch's, which says what Cutter tried, a tag or a version commit's push, and to give it an App. Once stable is your default branch, every commit after a change to a workflow file differs from it, so no run for a branch releases without one. A release branch whose workflow files differ from the default branch's holds every run's release. A run publishes a release.
A release line that is broken, that waits for a revert of a fix whose CI run failed there, that needs a GitHub App before Cutter can carry onto it or cut it, or that GitHub refuses every push of carried fixes or the fetch of trunk's commits to. One for each line, titled `release/1.0` is red, and fixes wait for it, `release/1.0` waits for a revert of a fix, `release/1.0` needs a GitHub App, and fixes wait for it, `release/1.0` can't take carried fixes, and they wait for you, or `release/1.0` can't be read, and fixes wait for you: Carrying fixes to release lines. A run that carries finds the line well, as when its tip's CI run passed, or the backport policy retired it, whether or not its branch exists, or its branch has no tag of its minor version. A run that finds the line's CI run still going, or that fails to ask GitHub, leaves the issue open.

Each issue says what happened, as the run's messages say it, what Cutter tried, and what to do, and links the run that last updated it. A later run updates the open issue for the same problem rather than filing another. Each has the label cutter, and its body starts with a hidden line that holds its problem's key; keep both, since a later run finds the issue by them and by its author, github-actions[bot]. The run's messages hold no token and no key, and the issue shows them as code, so a name in them mentions nobody. A request to GitHub that fails in a run for a branch, and a record that stops because GitHub failed in a way a later run doesn't meet again, file nothing.

A run for a tag that stops files its issue and succeeds, with published and record set to false, so a job that needs release starts. Give such a job if: needs.release.outputs.published == 'true', as the example does, so that it doesn't run for a release that is still waiting. A message that ends with run the release job again says that the release waits for the job to run again: no later run finishes it, since a run for trunk finishes only a release that GitHub has published.

When GitHub refuses to list or file the issues, as it does with issues turned off in your repository's settings, a run with something to file fails, and one with nothing to file warns. When GitHub answers that the token may not use the repository's issues, or that they are turned off, as a 401, 403, 404, or 410 does, the message says to grant issues: write and to turn issues on. For any other failure, such as a 5xx or no answer, the message holds GitHub's alone.

Why a run stops

Each message gives what Cutter found and what to do. With issues, a message for a cause you put right, and a message of a failed request to GitHub in a run for a tag, is also in an issue, and the run succeeds: Issues for a person. A run that stops before it publishes changes nothing: fix the cause, and push a new tag or run the workflow again. A record step that stops leaves the release published. It writes its message as a warning and in the summary, and succeeds: a later run records the release, whether a run of the job again or the next run for the branch the tag is on, as Finishing a release on a later run describes. When a later run can put the cause right, the message ends with ; a later run of the release job records it. Every other record message is for a cause that a later run finds again, and each such run warns again until you put the cause right.

Message Cause
v0.4 is not v plus a version such as v0.4.0 The tag's name isn't v followed by three numbers.
invoice/v0.4 is not invoice/v plus a version such as invoice/v0.4.0 The tag starts with a package's prefix, and the rest isn't v followed by three numbers.
v0.4.0 starts with no package's tag prefix: invoice/ or receipt/ The packages input is set, and the tag starts with none of its prefixes.
v0.4.0 is a lightweight tag; push an annotated tag (git tag -a) The tag has no tag object.
v0.4.0 now points at 1a2b3c4, not 4f2a9c1, which this run built; push a new tag on the commit you mean to release The tag points at another commit than this run built: it was moved after the run began, or this is a rerun of an older tag's run.
v0.4.0 points at 4f2a9c1, which is on no branch Cutter releases from The commit isn't on trunk, or on the right release/X.Y branch.
invoice/v1.0.1 points at 4f2a9c1, which is on neither trunk nor invoice/release/1.0 A package's patch tag from 1.0.0 on is on a commit that isn't on trunk, or on the package's release branch.
invoice/v0.4.0 points at 4f2a9c1, which is not on trunk, and Cutter releases a package's tag from a release branch only for a patch from 1.0.0 on A package's tag of any other version is on a commit that isn't on trunk.
test did not pass in this run, so v0.4.0 is not released A job of this run failed or was skipped. The message lists each one.
the version files at 4f2a9c1 don't all state 0.4.0: lib/invoice/version.rb states 0.3.2; tag the next version on a commit whose version files state it A file that states the version, as Version files lists them, states another version in the tagged tree, holds no line its declaration describes, or isn't a file there. The message lists each. Not in v0.9.1 or earlier: setdef/Cutter#98.
CHANGELOG.md at 4f2a9c1 calls for 0.4.0, not 0.3.3 The tag's version isn't the one the changelog calls for. For a package, the message gives both as its tags: gems/invoice/CHANGELOG.md at 4f2a9c1 calls for invoice/v0.4.0, not invoice/v0.3.3.
CHANGELOG.md at 4f2a9c1 lists nothing new since v0.3.2 Nothing to release.
CHANGELOG.md at 4f2a9c1 lists nothing under ## [Unreleased] Nothing to release, and GitHub has no release before it.
CHANGELOG.md at 4f2a9c1 does not exist; set the changelog input to your changelog's path The tagged commit has no file at the path the changelog input gives.
CHANGELOG.md at 4f2a9c1 has no ## [Unreleased] heading No line of the changelog is ## [Unreleased], with nothing before it on the line.
CHANGELOG.md at 4f2a9c1 has ### Breaking under ## [Unreleased], where Cutter reads only ### Added, ### Changed, ### Deprecated, ### Removed, ### Fixed, ### Security A heading under ## [Unreleased] isn't one of Keep a Changelog's six, so Cutter can't tell what its entries change.
CHANGELOG.md at 4f2a9c1 lists an entry under ## [Unreleased] before its first ### heading An entry has no heading, so Cutter can't tell what it changes.
this run uploaded no artifact named release The artifact you named is missing.
the artifact release could not be downloaded from this run; run the release job again This run uploaded the artifact, and downloading it failed.
the artifact release holds two or more files named invoice.gem: linux/invoice.gem, windows/invoice.gem; give each file a name of its own Two files of the artifact have one name, in different folders.
the artifact release holds checks/SHA256SUMS; leave it out, since Cutter writes SHA256SUMS The artifact holds a file named SHA256SUMS.
the artifact release holds a file whose name has a newline or a backslash: "a\nb.gem"; rename it A file's name holds a newline or a backslash, which a SHA256SUMS file can't list. The message shows the name escaped.
the artifact release holds a symbolic link, checks/latest.gem; upload the file itself The artifact holds a symbolic link, which could point outside the artifact's folder.
the release step got no GitHub token on standard input; run the release job again The step's token didn't reach Cutter.
GitHub answered 500 to GET /repos/acme/invoice/actions/runs/7/jobs; run the release job again GitHub answered a request with a status Cutter didn't expect. The message gives the request's method and path, and never GitHub's answer.
GitHub's answer to GET /repos/acme/invoice/actions/runs/7/jobs is not JSON; run the release job again GitHub answered a request with a success status and a body that is no JSON. The message gives the request's method and path, and never GitHub's answer.
GitHub's Link header names https://example.com:443, which is not the API's https://api.github.com:443; Cutter did not send its token there; run the release job again The next page of a list that GitHub gave is at another scheme, host, or port than GITHUB_API_URL. Cutter follows a next page only at the API's own address, since a request carries the token, and sends nothing to the other.
GET /repos/acme/invoice/git/ref/tags/v0.4.0 failed with Net::ReadTimeout; run the release job again A request timed out, or failed on the network, such as with Errno::ECONNREFUSED, before GitHub answered. The message gives the request's method and path, and the failure's class.
GitHub answered 500 to POST /uploads/12?name=invoice.gem; the release v0.4.0 was not published, and its draft is deleted; run the release job again GitHub refused an upload, or the publishing of the draft. Cutter deleted its draft, so the next run starts clean.
GitHub answered 500 to POST /uploads/12?name=invoice.gem; the release v0.4.0 was not published, and its draft could not be deleted; the next run deletes it; run the release job again The same, and GitHub refused to delete the draft too. The next run deletes it, and says so on standard error.
PATCH /repos/acme/invoice/releases/12 failed with Net::ReadTimeout; the release v0.4.0 may be published; run the release job again Publishing the draft got no answer, so the release may be published. Cutter deletes nothing, since that could delete a published release. The next run records the release if it was published and trunk's changelog has no heading for it, ends before step 2 with the notice that it has nothing left to do if trunk's changelog has one, and deletes the draft if the release wasn't published.
the packages input's line invoice/ has no changelog path after its tag prefix A line of the packages input has one word.
the packages input gives the tag prefix invoice/ twice Two lines of the packages input have one prefix.
the packages input's tag prefix invoice?/ is not letters, digits, and . _ - @, in parts between slashes that don't start with a period A prefix has another character, an empty part, or a part that starts with a period, such as ../.
the packages input's tag prefix -/ has no letter or digit to title its releases with A prefix has no letter or digit, such as -/ or _/, so the package's releases would have no title.
Cutter can't use .config/cutter.yml at 4f2a9c1: title is not a string The settings file at the commit holds something Cutter can't use. After the colon, the message gives the key's path and what is wrong with its value, or where in the file a YAML problem is.
this workflow runs for a branch or a tag, not for EVENT The calling workflow ran for another event than push or workflow_dispatch, such as pull_request.
v0.4.0 is released by a push of its tag, not by workflow_dispatch; push the tag, or rerun the run its push started The calling workflow ran for a tag by another event than push, such as workflow_dispatch. Cutter releases a tag only for the push that created it.
trunk moved under every try to record v0.4.0; a later run of the release job records it Three pushes of the record commit to the branch the message names lost races. The release is published, and a later run records it.
the record-command exited with 1 Your record-command failed. The release is published, and nothing is pushed.
the record-command changed .github/workflows/ci.yml, which the run's token can't push Your record-command changed a file under .github/workflows/, or .github/workflows itself, as when it replaces the folder with a file or a symbolic link. GitHub refuses either from the run's token. The release is published, and nothing is pushed.
CHANGELOG.md at 9c8b7a6 on trunk is not a file The tip of the branch the message names has no file at the path the changelog input gives, or the path goes through a symbolic link or has a backslash in it. The release is published, and nothing is pushed to that branch, or to trunk after it.
CHANGELOG.md at 9c8b7a6 on trunk is not UTF-8; save it as UTF-8 The changelog on the branch the message names has a byte that isn't valid UTF-8. Cutter writes nothing to it, since writing it back would change that byte. The release is published, and nothing is pushed to that branch, or to trunk after it.
CHANGELOG.md at 9c8b7a6 on trunk has no ## [Unreleased] heading The changelog on the branch the message names lost its ## [Unreleased] heading after the tagged commit. The release is published, and nothing is pushed to that branch, or to trunk after it.
GitHub refused the push to trunk: [remote rejected] (protected branch hook declined) GitHub refused the record commit for a reason other than another push, such as a rule of the branch's. The message names the branch and gives git's reason. The release is published.
git fetch failed; a later run of the release job records it git failed to fetch trunk; what it wrote is in the step's log. The release is published, and a later run records it.
GitHub answered 403 to the fetch of trunk GitHub refused git's fetch of the branch with a status of 401, 403, or 404, as it does for a token that may not read your repository. A later run is refused the same way until you put the cause right, so the step files the issue. The release is published, and nothing is pushed.
git push failed; a later run of the release job records it git failed to push the record commit, and GitHub gave no refusal, as when the connection failed or stalled. The release is published, and a later run records it.
git commit failed A git command other than the fetch and the push failed while it made the record commit, such as git commit; what it wrote is in the step's log. The release is published, and nothing more is pushed.
GitHub answered 500 to GET /repos/acme/invoice/contents/CHANGELOG.md; a later run of the release job records it GitHub answered a request that the record step made before the record commit with a status of 5xx, 408, or 429, or with a 403 that it gives for a rate limit, or the request failed on the network. The message gives the request's method and path, and never GitHub's answer. The release is published, and a later run records it.
GitHub answered 403 to GET /repos/acme/invoice/contents/CHANGELOG.md GitHub refused a request that the record step made before the record commit with a status of 4xx that asking again doesn't change, as it does for a token that may not read the changelog. A later run gets the same answer until you put the cause right, so the step files an issue. The release is published, and nothing is pushed.
the record step got no GitHub token on standard input The record step's token didn't reach Cutter. The release is published, and nothing is pushed.
GitHub answered 422 to POST /repos/acme/invoice/actions/workflows/ci.yml/dispatches; v0.4.0 is recorded on trunk in 9c8b7a6, and ci.yml did not start there; the next run of ci.yml on trunk tests 9c8b7a6 The record commit is on the branch the message names, and GitHub refused to start your CI workflow on it, as it does for a workflow without a workflow_dispatch trigger. The record step writes this as a warning, and succeeds.
GitHub answered 403 to PATCH /repos/acme/invoice/git/refs/heads/stable; a later run of the release job moves stable GitHub refused a request to move stable, or to find where it points, or to mint the App's token, or the request failed on the network. The release is published and recorded, and stable stays where it is until a later run moves it. The record step writes this as a warning, and succeeds.
the app-id input is set, but the record step got no app-private-key secret Moving stable needs the GitHub App, and you gave its ID without its key. The same holds for a key without an ID, and for a key that is no RSA private key in PEM form, each with a message that says which. The release is published and recorded, and stable stays where it is. The record step writes this as a warning, and succeeds, and each later run that would move stable warns again until you put the App right.

Cost

A run on a branch that Cutter previews nothing on makes none. A run on any other branch makes a few GitHub API requests, and a few more for each package of the packages input. For a version whose tag exists on no other commit, that includes one request to ask whether the commit is on trunk, and one more for a patch release from 1.0.0 on whose commit isn't. It also reads trunk's changelog, and from 1.0.0 on asks where stable points, and a run that finishes a release makes what a record step makes. A release makes a few dozen, one download of the artifact, and one upload of each of its files. GitHub allows a run's token 1,000 API requests per hour in a repository, shared with your other workflows' runs.

A run that carries fixes reads the settings file, one request, and asks for your tags and each line's branches, one request each for each hundred, and for each living line with a branch the CI run on its tip, and for each living line whether it lacks anything of the release, one request each. A released-within-days rule costs one request for each line whose first version has a tag. A line that lacks commits costs one more request for the commits on the line, a fetch of trunk's commits since the line began, and one push. A run that published nothing from trunk and is no run of a line carries nothing and asks nothing.

One release runs at a time in each repository: a run for a second tag waits for the first to finish, and neither cancels the other. With release-without-tag set to true, the release job of each run for trunk or a branch whose name holds release/ waits in the same line, and downloads your artifact and the version workflow's record, whether or not the run releases.

Examples

Release a Ruby gem

The settings file gives the title and lists the version file and the lockfile, so that each release's tree states its version:

title: Invoice
version-files:
  - path: lib/invoice/version.rb
    kind: version.rb
  - path: Gemfile.lock
    before: "    invoice ("
    after: ")"

The package job builds the gem with the version the version job names and uploads it as release:

  release:
    needs: [version, test, package]
    if: ${{ !cancelled() }}
    uses: setdef/Cutter/.github/workflows/release.yml@722bc85807fa248115a93fe5329187a0811bab37 # v0.9.3
    permissions:
      contents: write
      actions: write
      issues: write
    with:
      artifact: release

Release a project that people install from its tag

The project builds nothing to publish, such as a plugin that people install with git clone --branch v0.2.1. The job leaves out artifact, so the release has its notes and no files, and needs version, the job that calls the version workflow, so that a run for trunk releases its commit. .config/cutter.yml lists the file that states the version, so that each tag's tree states the version it is tagged as: Version files.

version-files:
  - path: VERSION
    before: ""
    after: ""

The job:

  release:
    needs: [version, test]
    if: ${{ !cancelled() }}
    uses: setdef/Cutter/.github/workflows/release.yml@722bc85807fa248115a93fe5329187a0811bab37 # v0.9.3
    permissions:
      contents: write
      actions: write
      issues: write

Release one package of several

A repository holds two gems, invoice and receipt, each in gems/ with its changelog and its version file. A tag such as invoice/v0.4.0 releases invoice alone. The settings file lists the packages, each with its version file:

packages:
  - prefix: invoice/
    changelog: gems/invoice/CHANGELOG.md
    version-files:
      - path: gems/invoice/lib/invoice/version.rb
        kind: version.rb
  - prefix: receipt/
    changelog: gems/receipt/CHANGELOG.md
    version-files:
      - path: gems/receipt/lib/receipt/version.rb
        kind: version.rb

The job:

  release:
    needs: [version, test, package]
    if: ${{ !cancelled() }}
    uses: setdef/Cutter/.github/workflows/release.yml@722bc85807fa248115a93fe5329187a0811bab37 # v0.9.3
    permissions:
      contents: write
      actions: write
      issues: write
    with:
      artifact: release

Use another changelog

Your changelog is docs/CHANGELOG.md, and your artifact is dist. The settings file gives the changelog:

changelog: docs/CHANGELOG.md

The job gives the artifact:

    with:
      artifact: dist

Move stable with a GitHub App

From 1.0.0 on, an App moves stable to a release whose workflow files differ from your default branch's, which the run's token can't. The App's ID is a variable of your repository, and its key a secret:

  release:
    needs: [version, test, package]
    if: ${{ !cancelled() }}
    uses: setdef/Cutter/.github/workflows/release.yml@722bc85807fa248115a93fe5329187a0811bab37 # v0.9.3
    permissions:
      contents: write
      actions: write
      issues: write
    with:
      artifact: release
      app-id: ${{ vars.RELEASE_APP_ID }}
    secrets:
      app-private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

Use the release's outputs in a later job

A job after release reads its outputs:

  announce:
    needs: release
    if: needs.release.outputs.published == 'true'
    runs-on: ubuntu-24.04
    steps:
      - run: echo "Released ${{ needs.release.outputs.tag }} from ${{ needs.release.outputs.commit }}"