diff --git a/release.sh b/release.sh index 1fed1a5..740d514 100755 --- a/release.sh +++ b/release.sh @@ -4,4 +4,23 @@ set -x cd "$(dirname "$0")" ROOT=$(pwd) -gh release create "$GITHUB_REF_NAME" -F ./Changelist.txt ./Binaries\ Linux/*.zip ./Binaries\ Windows/*.zip ./Binaries\ macOS/*.zip +VER="$GITHUB_REF_NAME" + +# Extract the changelog section for the current version +# Matches version with optional colon, captures until the next version line or EOF +NOTES=$(awk -v ver="$VER" ' + BEGIN { found=0; printing=0 } + $0 ~ "^"ver":?"$ { found=1; printing=1; next } + printing && /^[0-9]+\.[0-9]+\.[0-9]+:?$/ { printing=0 } + printing { print } + END { if (!found) exit 1 } +' ./Changelist.txt) + +if [ $? -ne 0 ] || [ -z "$NOTES" ]; then + echo "Error: Version $VER not found in Changelist.txt or has no content" + exit 1 +fi + +echo "$NOTES" > /tmp/release_notes.txt + +gh release create "$VER" -F /tmp/release_notes.txt ./Binaries\ Linux/*.zip ./Binaries\ Windows/*.zip ./Binaries\ macOS/*.zip diff --git a/tag.sh b/tag.sh index a1ff622..eb1bdb5 100755 --- a/tag.sh +++ b/tag.sh @@ -6,5 +6,12 @@ ROOT=$(pwd) cd $ROOT VER=`cat VERSION` + +# Check that the version exists in the Changelist.txt +if ! grep -q "^${VER}:*$" Changelist.txt; then + echo "Error: Version $VER not found in Changelist.txt" + exit 1 +fi + echo "Tagging [$VER]" git tag "$VER" && git push origin "$VER"