Skip to content

Commit

Permalink
Add demo.sh check to prerelease hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPickering committed May 10, 2024
1 parent 6b64ec4 commit 4f2744b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"},
]
Expand Down
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <major|minor|patch>`
- If it looks good, add `--execute`

Expand Down
22 changes: 20 additions & 2 deletions demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions static/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4f2744b

Please sign in to comment.