Created
March 11, 2022 01:00
-
-
Save mkhl/69385dcff945be01dba07742f81cb28f to your computer and use it in GitHub Desktop.
"keep a changelog" "management" "tools"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: changes <version> [<file>...] | |
# Print the changes made in <version> according to the changelog | |
# Defaults: <file>: CHANGELOG.md | |
if [ $# -eq 0 ]; then | |
usage "$0" | |
exit 64 | |
fi | |
VERSION=$1 | |
shift | |
awk -v tag="[$VERSION]" -e '/^## / { want = ($2 == tag) } want' CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: release <version> [<file>...] | |
# Update the changelog for releasing the current state as <version> | |
# Defaults: <file>: CHANGELOG.md | |
if [ $# -eq 0 ]; then | |
usage "$0" | |
exit 64 | |
fi | |
VERSION=$1 | |
shift | |
sed -E -f - CHANGELOG.md <<SED | |
/^## \[Unreleased\]\$/ a \\ | |
\\ | |
## [$VERSION] - $(date -Idate) | |
s;^\[Unreleased\]: ([^[:blank:]]+)/v([^/[:blank:]]+)...HEAD\$;\ | |
[Unreleased]: \1/v$VERSION...HEAD\\ | |
[$VERSION]: \1/v\2...v$VERSION; | |
SED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment