build: misc clean-ups in make_nightly_build

This commit is contained in:
CJ van den Berg 2025-09-22 21:48:55 +02:00
parent 7555331c1f
commit 87a72195d7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -19,21 +19,21 @@ if [ -e "$DESTDIR" ]; then
fi fi
if [ -e "$release_notes" ]; then if [ -e "$release_notes" ]; then
echo file \"$release_notes\" already exists echo file \""$release_notes"\" already exists
exit 1 exit 1
fi fi
DIFF="$(git diff --stat --patch HEAD)" DIFF="$(git diff --stat --patch HEAD)"
if [ -n "$DIFF" ] ; then if [ -n "$DIFF" ]; then
echo there are outstanding changes: echo there are outstanding changes:
echo "$DIFF" echo "$DIFF"
exit 1 exit 1
fi fi
UNPUSHED="$(git log --pretty=oneline @{u}...)" UNPUSHED="$(git log --pretty=oneline '@{u}...')"
if [ -n "$UNPUSHED" ] ; then if [ -n "$UNPUSHED" ]; then
echo there are unpushed commits: echo there are unpushed commits:
echo "$UNPUSHED" echo "$UNPUSHED"
exit 1 exit 1
@ -41,13 +41,13 @@ fi
# get latest version tag from github releases api # get latest version tag from github releases api
last_nightly_version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | cut -d'"' -f4) last_nightly_version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | cut -d'"' -f4)
[ -z "last_nightly_version" ] && { [ -z "$last_nightly_version" ] && {
echo "failed to fetch $title latest version" echo "failed to fetch $title latest version"
exit 1 exit 1
} }
local_version="$(git --git-dir $BASEDIR/.git describe)" local_version="$(git --git-dir "$BASEDIR/.git" describe)"
if [ "$local_version" == "$last_nightly_version" ] ; then if [ "$local_version" == "$last_nightly_version" ]; then
echo "$title is already at version $last_nightly_version" echo "$title is already at version $last_nightly_version"
exit 1 exit 1
fi fi
@ -101,11 +101,13 @@ echo
cd .. cd ..
echo $title > "$release_notes" {
echo > "$release_notes" echo "$title"
echo "changes:" > "$release_notes" echo "$release_notes"
echo > "$release_notes" echo "changes:"
git log "${last_nightly_version}..HEAD" --pretty="format:%al %s" >> "$release_notes" echo
} >"$release_notes"
git log "${last_nightly_version}..HEAD" --pretty="format:%al %s" >>"$release_notes"
cat "$release_notes" cat "$release_notes"
gh release create "$VERSION" --repo "$repo" --notes-file "$release_notes" $DESTDIR/* gh release create "$VERSION" --repo "$repo" --notes-file "$release_notes" $DESTDIR/*