Compare commits

...

4 commits

View file

@ -6,6 +6,7 @@ for arg in "$@"; do
--no-github) NO_GITHUB=1 ;; --no-github) NO_GITHUB=1 ;;
--no-codeberg) NO_CODEBERG=1 ;; --no-codeberg) NO_CODEBERG=1 ;;
--no-flowcontrol) NO_FLOWCONTROL=1 ;; --no-flowcontrol) NO_FLOWCONTROL=1 ;;
--allow-dirty) ALLOW_DIRTY=1 ;;
esac esac
done done
@ -33,6 +34,7 @@ fi
DIFF="$(git diff --stat --patch HEAD)" DIFF="$(git diff --stat --patch HEAD)"
if [ -z "$ALLOW_DIRTY" ]; then
if [ -n "$DIFF" ]; then if [ -n "$DIFF" ]; then
echo there are outstanding changes: echo there are outstanding changes:
echo "$DIFF" echo "$DIFF"
@ -46,9 +48,17 @@ if [ -n "$UNPUSHED" ]; then
echo "$UNPUSHED" echo "$UNPUSHED"
exit 1 exit 1
fi fi
fi
# get latest version tag # get latest version tag
if [ -z "$NO_FLOWCONTROL" ]; then
last_nightly_version=$(curl -s https://git.flow-control.dev/api/v1/repos/neurocyte/flow-nightly/releases/latest | jq -r .tag_name)
elif [ -z "$NO_GITHUB" ]; then
last_nightly_version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r .tag_name) last_nightly_version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r .tag_name)
elif [ -z "$NO_CODEBERG" ]; then
last_nightly_version=$(curl -s https://codeberg.org/api/v1/repos/neurocyte/flow-nightly/releases/latest | jq -r .tag_name)
fi
[ -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
@ -75,9 +85,13 @@ echo building...
./zig build -Dpackage_release --prefix "$DESTDIR/build" ./zig build -Dpackage_release --prefix "$DESTDIR/build"
VERSION=$(/bin/cat "$DESTDIR/build/version")
git archive --format=tar.gz --output="$DESTDIR/flow-$VERSION-source.tar.gz" HEAD
git archive --format=zip --output="$DESTDIR/flow-$VERSION-source.zip" HEAD
cd "$DESTDIR/build" cd "$DESTDIR/build"
VERSION=$(/bin/cat version)
TARGETS=$(/bin/ls) TARGETS=$(/bin/ls)
for target in $TARGETS; do for target in $TARGETS; do
@ -114,43 +128,48 @@ echo
cd .. cd ..
{ {
echo "$title" "$VERSION" echo "## commits in this build"
echo
echo "commits:"
echo echo
git log "${last_nightly_version}..HEAD" --pretty="format:neurocyte/$APPNAME@%h %s" git log "${last_nightly_version}..HEAD" --pretty="format:neurocyte/$APPNAME@%h %s"
echo echo
echo echo
echo "contributors to this release:" echo "## contributors"
git shortlog -s -n "${last_nightly_version}..HEAD" | cut -b 8- git shortlog -s -n "${last_nightly_version}..HEAD" | cut -b 8-
echo echo
echo
echo "also available at:" echo "## downloads"
echo "[flow-control.dev](https://git.flow-control.dev/neurocyte/flow-nightly/releases/tag/$VERSION)" echo "[flow-control.dev](https://git.flow-control.dev/neurocyte/flow-nightly/releases/tag/$VERSION) (source only)"
echo "[github.com](https://github.com/neurocyte/flow-nightly/releases/tag/$VERSION)" echo "[github.com](https://github.com/neurocyte/flow-nightly/releases/tag/$VERSION) (binaries & source)"
echo "[codeberg.org](https://codeberg.org/neurocyte/flow-nightly/releases/tag/$VERSION)" echo "[codeberg.org](https://codeberg.org/neurocyte/flow-nightly/releases/tag/$VERSION) (binaries & source)"
} >"$release_notes" } >"$release_notes"
cat "$release_notes" cat "$release_notes"
ASSETS=""
if [ -z "$NO_FLOWCONTROL" ]; then if [ -z "$NO_FLOWCONTROL" ]; then
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.tar.gz"
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.tar.gz.sig"
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.tar.gz.sha256"
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.zip"
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.zip.sig"
ASSETS="$ASSETS --asset $DESTDIR/flow-${VERSION}-source.zip.sha256"
echo uploading to git.flow-control.dev echo uploading to git.flow-control.dev
tea releases create --login flow-control --repo "$repo" --tag "$VERSION" --title "$title $VERSION" --note-file "$release_notes" tea releases create --login flow-control --repo "$repo" --tag "$VERSION" --title "$title $VERSION" --note-file "$release_notes" \
$ASSETS
fi fi
if [ -z "$NO_CODEBERG" ]; then if [ -z "$NO_CODEBERG" ]; then
ASSETS=""
for a in $DESTDIR/*; do for a in $DESTDIR/*; do
ASSETS="$ASSETS --asset $a" ASSETS="$ASSETS --asset $a"
done done
echo uploading to codeberg.org echo uploading to codeberg.org
tea releases create --login codeberg --repo "$repo" --tag "$VERSION" --title "$title $VERSION" --note-file "$release_notes" $ASSETS tea releases create --login codeberg --repo "$repo" --tag "$VERSION" --title "$title $VERSION" --note-file "$release_notes" \
$ASSETS
fi fi
if [ -z "$NO_GITHUB" ]; then if [ -z "$NO_GITHUB" ]; then
echo uploading to github.com echo uploading to github.com
gh release create "$VERSION" --repo "$repo" --notes-file "$release_notes" $DESTDIR/* gh release create "$VERSION" --repo "$repo" --title "$title $VERSION" --notes-file "$release_notes" $DESTDIR/*
fi fi