Release Process#
Release Workflow#
This project keeps release notes in towncrier fragments and uses
cocogitto (cog) to determine the next semantic version from Conventional
Commits.
The package version itself is derived from Git tags via hatch-vcs, so there
is no manual version file to edit.
The actual publish step is handled by .github/workflows/release.yml after a
v* tag is pushed.
Canonical Docs Note#
Org sources are authoritative. Generated Markdown or rendered docs should not be edited separately.
Steps#
Run the block as one bash script, since it exits at the first failing command.
set -euo pipefail
# 1. Run the same checks the tag workflow expects
# --frozen uses uv.lock as committed and never rewrites it
uv sync --frozen --extra test --extra plot --extra lint --extra doc --extra release
uv run --frozen pytest --cov=chemparseplot tests
uv run --frozen ruff check .
uv run --frozen ruff format --check .
# Emacs 30 writes doc/source/index.rst. Sphinx reads that file.
(cd docs && emacs --batch --load export.el)
uv run --frozen sphinx-build doc/source/ doc/build
# 2. Preview the next semantic version; the heading drops the v
if ! NEXT="$(cog bump --dry-run --auto)"; then
echo "release: cog bump --dry-run --auto failed, stopping" >&2
exit 1
fi
if [[ ! "$NEXT" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "release: cog gave '$NEXT', not vX.Y.Z, stopping" >&2
exit 1
fi
NEXT="${NEXT#v}"
# 3. Aggregate towncrier fragments into CHANGELOG.md
uvx towncrier build --version "$NEXT"
# 4. Commit the release notes and consumed fragments
# towncrier stages CHANGELOG.md and git-removes the consumed fragments;
# --ignore-unmatch keeps git rm from failing once that removal is staged
git add CHANGELOG.md
git rm -r -q --ignore-unmatch doc/release/upcoming_changes
git commit -m "release: v$NEXT"
# 5. Tag the release and push
cog bump --auto
git push origin main --tags
# 6. GitHub Actions publishes from the pushed tag
Rationale#
towncrierremains the structured release-notes source.coggives a cleaner semantic-version selection step than manual tag math.hatch-vcscontinues to derive the installable package version from the tag.The changelog heading stays on plain
X.Y.Zeven when the pushed Git tag isvX.Y.Z.The release workflow already runs tests, lint, docs, build, PyPI publish, and GitHub release creation after the tag is pushed.