nix: postgrest-release modifies CHANGELOG

This commit is contained in:
steve-chavez
2022-10-28 17:52:58 -05:00
committed by Steve Chavez
parent 2c31c64325
commit 0b1f8358c6
+11 -2
View File
@@ -51,7 +51,7 @@ let
checkedShellScript checkedShellScript
{ {
name = "postgrest-release"; name = "postgrest-release";
docs = "Patch postgrest.cabal, tag and push all in one go."; docs = "Patch postgrest.cabal, CHANGELOG.md, tag and push all in one go.";
args = [ "ARG_POSITIONAL_SINGLE([version], [Version to release], [pre])" ]; args = [ "ARG_POSITIONAL_SINGLE([version], [Version to release], [pre])" ];
inRootDir = true; inRootDir = true;
} }
@@ -69,7 +69,9 @@ let
IFS=. read -r major minor patch pre <<< "$current_version" IFS=. read -r major minor patch pre <<< "$current_version"
echo "Current version is $current_version" echo "Current version is $current_version"
bump_pre="$major.$minor.$patch.$(date '+%Y%m%d')" today_date="$(date '+%Y%m%d')"
today_date_for_changelog="$(date '+%Y-%m-%d')"
bump_pre="$major.$minor.$patch.$today_date"
bump_patch="$major.$minor.$((patch+1))" bump_patch="$major.$minor.$((patch+1))"
bump_minor="$major.$((minor+1)).0" bump_minor="$major.$((minor+1)).0"
bump_major="$((major+1)).0.0" bump_major="$((major+1)).0.0"
@@ -92,6 +94,13 @@ let
echo "Committing ..." echo "Committing ..."
git add postgrest.cabal > /dev/null git add postgrest.cabal > /dev/null
if [[ "$new_version" != "$bump_pre" ]]; then
echo "Updating CHANGELOG.md ..."
sed -i -E "s/Unreleased/&\n\n## [$new_version] - $today_date_for_changelog/" CHANGELOG.md > /dev/null
git add CHANGELOG.md > /dev/null
fi
git commit -m "bump version to $new_version" > /dev/null git commit -m "bump version to $new_version" > /dev/null
echo "Tagging ..." echo "Tagging ..."