From 4f2744b4461b71e1cc3342403e200030963180f8 Mon Sep 17 00:00:00 2001 From: Lucas Pickering Date: Fri, 10 May 2024 11:13:18 -0400 Subject: [PATCH] Add demo.sh check to prerelease hooks --- Cargo.toml | 1 + RELEASE.md | 1 + demo.sh | 22 ++++++++++++++++++++-- static/demo.gif | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8701f854..c917065b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,7 @@ inherits = "release" lto = "thin" [workspace.metadata.release] +pre-release-hook = ["./demo.sh", "--check"] pre-release-replacements = [ {file = "CHANGELOG.md", search = "## \\[Unreleased\\] - ReleaseDate", replace = "## [Unreleased] - ReleaseDate\n\n## [{{version}}] - {{date}}"}, ] diff --git a/RELEASE.md b/RELEASE.md index b0fcfa52..490cd133 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,7 @@ It's easy! - Make sure `CHANGELOG.md` has the latest release notes under `[Unreleased] - ReleaseDate` +- Regenerate the demo gif with `./demo.sh` (and commit changes) - `cargo release ` - If it looks good, add `--execute` diff --git a/demo.sh b/demo.sh index a4b9f6d3..29864ad3 100755 --- a/demo.sh +++ b/demo.sh @@ -2,5 +2,23 @@ # Regenerate the demo GIF from the VHS tape # https://github.com/charmbracelet/vhs -rm -rf data/ # Delete temp data so the GIF is consistent -vhs static/demo.tape +case $1 in + "--check") + latest_commit=$(git rev-parse HEAD) + latest_gif_commit=$(git log -n 1 --pretty=format:%H -- static/demo.gif) + if [ $latest_commit = $latest_gif_commit ]; then + echo "Good to go!" + else + echo "Demo gif is out of date" + echo "Run './demo.sh' to regenerate" + exit 1 + fi + ;; + "") + rm -rf data/ # Delete temp data so the GIF is consistent + vhs static/demo.tape + ;; + *) + echo "Invalid args: $@" + exit 1 +esac diff --git a/static/demo.gif b/static/demo.gif index dbb08604..5ef5407a 100644 --- a/static/demo.gif +++ b/static/demo.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b238e76fb3c5cb882c1f0b5d964fd2a6fe6b5aafdaef914d820a2ee42ec442e0 -size 365737 +oid sha256:8d9c3929ff233dbbd29e2787f628aa7e7269d63ae727bfbe9c71a119cf26cf64 +size 343035