2024-02-01 10:03:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ROOT_DIR=$( dirname $( realpath $0 ) )
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-05-03 15:40:05 +02:00
|
|
|
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."
|
|
|
|
|
2024-10-17 14:26:52 +02:00
|
|
|
echo "Latest published release: $( /usr/bin/git tag | tail -n 1 )"
|
|
|
|
|
2024-03-10 19:00:41 +01:00
|
|
|
LATEST="$1"
|
|
|
|
|
|
|
|
if [ -z "$LATEST" ]
|
|
|
|
then
|
|
|
|
echo -n "Getting latest release..."
|
2024-05-03 15:40:05 +02:00
|
|
|
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//' )
|
2024-03-10 19:00:41 +01:00
|
|
|
echo done.
|
|
|
|
fi
|
2024-02-01 10:03:42 +01:00
|
|
|
|
2024-10-17 14:26:52 +02:00
|
|
|
echo "Latest upstream release: $LATEST"
|
2024-05-03 15:40:05 +02:00
|
|
|
[ -n "$( /usr/bin/git tag -l "$LATEST" )" ] && echo "Release $LATEST already exists" && exit 1
|
2024-02-01 10:03:42 +01:00
|
|
|
|
2024-10-17 14:26:52 +02: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
|
2024-05-03 15:40:05 +02:00
|
|
|
/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..."
|
2024-05-03 15:40:05 +02:00
|
|
|
/usr/bin/git push
|
|
|
|
/usr/bin/git push --tags
|
2024-02-01 10:03:42 +01:00
|
|
|
echo done.
|
2024-10-17 14:26:52 +02:00
|
|
|
|
|
|
|
echo "Not release $LATEST published. Follow build process there:"
|
|
|
|
echo "https://gitea.zionetrix.net/bn8/forgejo_debian_packager/actions"
|