forgejo_debian_packager/publish_new_release.sh

63 lines
1.4 KiB
Bash
Raw Normal View History

2024-02-01 10:03:42 +01:00
#!/bin/bash
ROOT_DIR=$( dirname $( realpath $0 ) )
set -e
echo "Checking dependencies..."
MISSING_PACKAGES=()
for bin in /usr/bin/curl /usr/bin/xq /usr/bin/sed /usr/bin/git
do
echo -n "- $bin: "
if [ -x "$bin" ]
then
echo "OK"
else
echo "Missing"
MISSING_PACKAGES+=( $(basename $bin) )
fi
done
if [ ${#MISSING_PACKAGES[@]} -gt 0 ]
then
echo "Install missing packages (${MISSING_PACKAGES[@]})..."
apt install -y ${#MISSING_PACKAGES[@]}
fi
2024-08-30 08:53:58 +02:00
cd $ROOT_DIR
echo "Update git repo:"
git pull
echo "done."
echo "Latest published release: $( /usr/bin/git tag | tail -n 1 )"
LATEST="$1"
if [ -z "$LATEST" ]
then
echo -n "Getting latest release..."
LATEST=$( /usr/bin/curl --silent https://forgejo.org/releases/rss.xml|/usr/bin/xq -x '/rss/channel/item[1]/title'|/usr/bin/sed 's/^v//' )
echo done.
fi
2024-02-01 10:03:42 +01:00
echo "Latest upstream release: $LATEST"
[ -n "$( /usr/bin/git tag -l "$LATEST" )" ] && echo "Release $LATEST already exists" && exit 1
2024-02-01 10:03:42 +01:00
echo "Press [enter] to create and publish this new release $LATEST"
2024-02-01 10:03:42 +01:00
read
echo "Create new release..."
echo -n "$LATEST" > last_release.txt
/usr/bin/git add last_release.txt
/usr/bin/git commit -m "Release $LATEST"
/usr/bin/git tag "$LATEST"
2024-02-01 10:03:42 +01:00
echo done.
echo "Publish new release..."
/usr/bin/git push
/usr/bin/git push --tags
2024-02-01 10:03:42 +01:00
echo done.
echo "Not release $LATEST published. Follow build process there:"
echo "https://gitea.zionetrix.net/bn8/forgejo_debian_packager/actions"