Skip to content

Commit 0ef2b94

Browse files
committed
Changed: improve release safety and consolidate error handling
Ensure cargo publish uses the lockfile for reproducible releases. Refactor the tag_release script to use a single exception handler for various process and validation failures.
1 parent 9ed8915 commit 0ef2b94

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

docs/RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ gh release create "$TAG" --notes-from-tag
194194

195195
```bash
196196
# Sanity check before publishing
197-
cargo publish --dry-run
197+
cargo publish --locked --dry-run
198198

199199
# Publish the crate (ensure docs are already updated on main via the PR)
200-
cargo publish
200+
cargo publish --locked
201201
```
202202

203203
---

scripts/tag_release.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,15 @@ def main() -> None:
278278

279279
try:
280280
create_tag(args.version, force=args.force)
281-
except (ValueError, FileNotFoundError, LookupError) as exc:
281+
except (
282+
ValueError,
283+
FileNotFoundError,
284+
LookupError,
285+
ExecutableNotFoundError,
286+
subprocess.CalledProcessError,
287+
) as exc:
282288
print(f"Error: {exc}", file=sys.stderr)
283289
sys.exit(1)
284-
except ExecutableNotFoundError as exc:
285-
print(f"Error: {exc}", file=sys.stderr)
286-
sys.exit(1)
287-
except subprocess.CalledProcessError as exc:
288-
print(f"Error: git command failed: {exc}", file=sys.stderr)
289-
sys.exit(1)
290290

291291

292292
if __name__ == "__main__":

0 commit comments

Comments
 (0)