53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
|
#!/usr/bin/sh
|
||
|
|
||
|
function get_latest_version()
|
||
|
{
|
||
|
repo=$1
|
||
|
prefix="v"
|
||
|
[ -n "$2" ] && prefix="$2-v"
|
||
|
|
||
|
releases_json=$(curl -sfX GET "https://git.serguzim.me/api/v1/repos/emgauwa/$repo/releases" -H "accept: application/json")
|
||
|
[ $? -ne 0 ] && echo "v0.0.0" && exit
|
||
|
|
||
|
tags=$(echo $releases_json | jq -r ".[] | select(.tag_name | test(\"$prefix*\")).tag_name")
|
||
|
|
||
|
latest_version="0.0.0"
|
||
|
|
||
|
for tag in $tags; do
|
||
|
version=$(echo $tag | sed "s/^$prefix//")
|
||
|
[ $(vercmp $version $latest_version) -gt 0 ] && latest_version=$version
|
||
|
done
|
||
|
|
||
|
echo $latest_version
|
||
|
}
|
||
|
|
||
|
cd core
|
||
|
latest_version=$(get_latest_version core)
|
||
|
sed -i "s/pkgver=.*$/pkgver=$latest_version/" PKGBUILD
|
||
|
updpkgsums
|
||
|
cd ..
|
||
|
|
||
|
cd core-testing
|
||
|
latest_version=$(get_latest_version core testing)
|
||
|
sed -i "s/pkgver=.*$/pkgver=$latest_version/" PKGBUILD
|
||
|
updpkgsums
|
||
|
cd ..
|
||
|
|
||
|
cd controller
|
||
|
latest_version=$(get_latest_version controller)
|
||
|
sed -i "s/pkgver=.*$/pkgver=$latest_version/" PKGBUILD
|
||
|
updpkgsums
|
||
|
cd ..
|
||
|
|
||
|
cd controller-testing
|
||
|
latest_version=$(get_latest_version controller testing)
|
||
|
sed -i "s/pkgver=.*$/pkgver=$latest_version/" PKGBUILD
|
||
|
updpkgsums
|
||
|
cd ..
|
||
|
|
||
|
cd webapp
|
||
|
latest_version=$(get_latest_version client)
|
||
|
sed -i "s/pkgver=.*$/pkgver=$latest_version/" PKGBUILD
|
||
|
updpkgsums
|
||
|
cd ..
|