fix(release): skip the changelog hook during a dry run
`just release-plan` is documented as a preview that writes nothing, but cargo-release runs pre-release hooks during a dry run too. The hook wrote CHANGELOG.md and `git add`ed it, so the clean-tree check in `just release` then refused to run — the repo's own two-step release workflow could not be followed as written. Guard the hook on DRY_RUN, which cargo-release 1.1.5 exports to the hook environment (verified by dumping `env` from a throwaway hook; it also sets CRATE_NAME, PREV_VERSION and NEW_VERSION). The clean-tree check itself is left alone: it is load-bearing, because publishing is irreversible. Closes #36 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014b6wy2q8rnFK8U8GPJVQNU
This commit is contained in:
+9
-1
@@ -3,4 +3,12 @@ publish = true
|
||||
# Hold off pushing until tags and publish have both succeeded; `just release`
|
||||
# pushes last.
|
||||
push = false
|
||||
pre-release-hook = ["sh", "-c", "git cliff -o CHANGELOG.md --tag {{version}} && git add CHANGELOG.md"]
|
||||
# Regenerate the changelog and stage it so it lands in the release commit.
|
||||
#
|
||||
# Guarded on DRY_RUN because cargo-release runs pre-release hooks during a dry
|
||||
# run too (verified against cargo-release 1.1.5, which exports DRY_RUN=true,
|
||||
# CRATE_NAME, PREV_VERSION and NEW_VERSION to the hook). Without the guard,
|
||||
# `just release-plan` — documented as a preview that writes nothing — writes and
|
||||
# `git add`s CHANGELOG.md, and the clean-tree check in `just release` then
|
||||
# refuses to run. That check is load-bearing: publishing is irreversible.
|
||||
pre-release-hook = ["sh", "-c", '[ "$DRY_RUN" = "true" ] || (git cliff -o CHANGELOG.md --tag {{version}} && git add CHANGELOG.md)']
|
||||
|
||||
Reference in New Issue
Block a user