Last active
March 20, 2024 10:15
-
-
Save diego-betto/4e9a74b7dba5b68a9d30428c177e2d54 to your computer and use it in GitHub Desktop.
Bash script to generate a CHANGELOG.md file based on git tags
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/bash | |
shopt -s lastpipe | |
footerTags=() | |
echo "# Changelog | |
This document maintains a list of released versions and changes done in respective versions. | |
" > ./CHANGELOG.md | |
git tag -l --sort=-creatordate | while read tag; do | |
echo '## Version'" [${tag}]" >> ./CHANGELOG.md | |
echo '' >> ./CHANGELOG.md | |
git log ${tag}..${NEXT_TAG} --pretty=format:'* %s ' >> ./CHANGELOG.md | |
echo ''>> ./CHANGELOG.md | |
echo '--'>> ./CHANGELOG.md | |
echo ''>> ./CHANGELOG.md | |
footerTags+=("${tag}...${NEXT_TAG}") | |
NEXT_TAG=${tag} | |
done | |
echo $footerTags | |
for str in ${footerTags[@]}; do | |
echo str | |
tag="${str##*...}" | |
echo "[${tag}]: $1/-/compare/${str}" >> ./CHANGELOG.md | |
done | |
echo 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Footer links