<!-- https://docs.dseams.info/contributing/developer/release.md -->

# Cutting a seams-core release {#cutting-a-seams-core-release}

The numbered seams-core release cut. `meson.build` is the version source.
Everything in `ci/version/files.txt` is a cogapp copy. The tag prefix in
`cog.toml` is `v`.

## One version, then the copies {#one-version-then-the-copies}

`ci/version/seams_version.py` reads `project(..., version: '...')` from
`meson.build`. `pixi run --frozen -e version release-cog` rewrites the
copies. `pixi run --frozen -e version version-drift` fails if a copy has
drifted. The prek hook `version-drift` runs that check.

Do not edit a copy by hand. Cocogitto changes `meson.build` with Meson’s
rewriter before cogapp regenerates the copies. Its cogapp hook supplies the
ship day as `SEAMS_RELEASE_DATE`; ordinary drift checks keep the committed
date.

## The cut {#the-cut}

Work on `main`, with the fragments for this version already in
the fragment directory.

1. Preview the notes and validate the fragment names.

   Fragments for the version being cut live in that version’s directory.
   The 2.14.0 files at the top of the fragment directory are not the next
   release. The version environment tasks that validate fragment names and
   print the unreleased notes are listed in `pixi.toml`. The preview prints
   only fragments that are not already a changelog section. Run those two
   tasks with `pixi run --frozen -e version`.
2. Ask cocogitto for the tag. `--dry-run` prints it and does not write.

   ```default
   cog bump --auto --dry-run
   ```

   `--auto` follows the commit types in `cog.toml`. A `feat:` commit
   selects a minor bump, a `fix:` commit selects a patch bump, and a
   breaking change marked with `!` selects a major bump. `perf:` does
   not select a bump. The dry-run prints the next unreleased tag, the
   same tag a later `--auto` will create. It does not print `v2.14.3`:
   that tag already exists and is below the version in `meson.build`.
3. Run the bump from an environment that provides Meson, cogapp, and
   the notes builder. The pre-bump hooks use Meson’s rewriter to set the source
   version, set the ship date in `CITATION.cff` and `codemeta.json`,
   rewrite the copies listed in `ci/version/files.txt`, and build the notes for that version.
   The hook writes that version’s section from the fragments in its directory.
   With no fragments the section is the heading plus the ship date, and the
   2.14.0 files stay. Cocogitto commits the rendered changelog and creates the annotated tag.

   ```default
   cog bump --auto
   ```

   Cocogitto creates the bump commit and the annotated tag from the
   rule above. Do not create a second tag by hand.
4. Check the metadata, copies, and tag. Replace `vX.Y.Z` with the tag
   the dry-run printed.

   ```default
   python3 scripts/check_release_version.py --tag vX.Y.Z
   pixi run --frozen -e version version-drift
   git rev-parse vX.Y.Z^{commit}
   git rev-parse HEAD
   ```
5. Push the bump commit and the tag. `.github/workflows/release.yml` runs
   on a `v*` tag of `d-SEAMS/seams-core`. It checks the tag against
   `meson.build`, checks the cogapp copies, and opens the GitHub release
   with `GITHUB_TOKEN`. A `workflow_dispatch` with an existing tag
   rebuilds that tag without creating another one. The workflow does not
   publish to a package registry. `ci_docs.yml` updates `gh-pages` from
   `main`, also with `GITHUB_TOKEN`. A tag push does not deploy the book.

## After the tag {#after-the-tag}

conda-forge `libseams` takes `recipe/recipe.yaml`. Fill the archive sha256
once the tag exists. `libseams_jll` takes
`packaging/yggdrasil/L/libseams/build_tarballs.jl`, including the commit
the tag points at.

The bindings release from their own repositories against this tag, in
this order: PydSEAMSlib (PyPI), dseams-rs (crates.io), dseams-r (CRAN),
Dseams.jl (General, after `libseams_jll`), dseams-fortran (fpm), then
dseams-plumed when its plugin version changes. yodaStruct is the Lua
binding and is not locked to this number.

## A fix on top of a release {#a-fix-on-top-of-a-release}

Branch from the tag, add a `fix:` commit and a fragment, and
`cog bump --auto`. The rule is the same one as the dry-run: a branch
whose commits select only a patch bump gets the next patch, and a
`feat:` commit on that branch selects a minor bump.

## What this replaces {#what-this-replaces}

Cogapp regenerates the version copies, and `version-drift` checks them.
The notes builder checks changed fragments and drafts the notes in
release-prepare. The preview is the fragments that are not already a
changelog section, and the pre-bump hook builds that section. With no
fragments the section is the heading plus the ship date.
`scripts/check_release_version.py` retains the release heading, date, and
tag assertions. Duplicate fragment bodies, every misnamed fragment, and
hand-added duplicate release headings remain outside the native checks.
`.github/workflows/release-prepare.yml` is the dry-run on a pull request
and on `workflow_dispatch`.
