aur/.util.sh
nyyu ccbc2e9bd5
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/cron/woodpecker Pipeline was successful
fix(ci): tmp fix pkgrel cs-firewall-bouncer
2023-08-11 11:59:48 +02:00

29 lines
1009 B
Bash

#!/bin/bash
update_github_tag() {
local ver=$(curl -Ls https://api.github.com/repos/"$1"/tags | jq -r '[.[] | select(.name | index("rc") | not) | select (.name | index("dev") | not) | select (.name | index("beta") | not)] | first | .name' | sed 's/^v//')
echo "${ver}" | grep -Eq "^(\w|\+|\.)+$" && sed -i "s/pkgver=.*/pkgver=${ver}/" PKGBUILD
}
update_gitea_tag() {
local ver=$(curl -Ls https://gitea.com/api/v1/repos/"$1"/releases/latest | jq -r '.name' | sed 's/^v//')
echo "${ver}" | grep -Eq "^(\w|\+|\.)+$" && sed -i "s/pkgver=.*/pkgver=${ver}/" PKGBUILD
}
update_pkg() {
if [[ $(git diff . | wc -l) -ne 0 ]]; then
sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD
if updpkgsums; then
makepkg --printsrcinfo >.SRCINFO
local ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
git add .SRCINFO PKGBUILD
if git commit -m "$(basename $(pwd)): update to ${ver} [CI SKIP]"; then
git push --set-upstream origin "${CI_COMMIT_BRANCH}"
fi
fi
fi
}