22 lines
610 B
Bash
22 lines
610 B
Bash
#!/bin/bash
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
set -euo pipefail
|
|
|
|
install="{{ git_server_working_dir }}"
|
|
arch="linux-amd64"
|
|
|
|
version=$(curl -s https://forgejo.org/releases/rss.xml | xq -x '//rss/channel/item[1]/title' | sed 's/^v//')
|
|
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9\-]+$ ]]; then
|
|
echo "invalid version: $version"
|
|
exit 1
|
|
fi
|
|
|
|
ofile="$install/forgejo-$version"
|
|
if [ ! -e "$ofile" ]; then
|
|
curl -s "https://codeberg.org/forgejo/forgejo/releases/download/v$version/forgejo-$version-$arch" > "$ofile"
|
|
chmod 755 "$ofile"
|
|
ln -sf "$ofile" "$install/forgejo"
|
|
systemctl restart forgejo.service
|
|
fi
|