Add git role
This commit is contained in:
parent
303e188e24
commit
5dd519d88a
9 changed files with 215 additions and 0 deletions
22
roles/git-server/templates/update.sh
Normal file
22
roles/git-server/templates/update.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue