aur/.util.sh

29 lines
1009 B
Bash
Raw Normal View History

2022-06-28 10:30:05 +02:00
#!/bin/bash
2021-07-26 20:34:17 +02:00
2021-07-26 20:37:40 +02:00
update_github_tag() {
2023-02-11 11:42:03 +01:00
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//')
2022-06-28 10:30:05 +02:00
echo "${ver}" | grep -Eq "^(\w|\+|\.)+$" && sed -i "s/pkgver=.*/pkgver=${ver}/" PKGBUILD
2021-07-26 20:37:40 +02:00
}
2023-08-05 14:40:59 +02:00
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
}
2021-07-26 20:34:17 +02:00
update_pkg() {
2023-04-09 09:51:46 +02:00
if [[ $(git diff . | wc -l) -ne 0 ]]; then
sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD
2021-07-26 20:34:17 +02:00
2022-06-28 10:30:05 +02:00
if updpkgsums; then
makepkg --printsrcinfo >.SRCINFO
2022-11-16 22:37:48 +01:00
local ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ')
2021-07-26 20:34:17 +02:00
git add .SRCINFO PKGBUILD
2022-06-28 10:30:05 +02:00
if git commit -m "$(basename $(pwd)): update to ${ver} [CI SKIP]"; then
2022-11-16 22:07:36 +01:00
git push --set-upstream origin "${CI_COMMIT_BRANCH}"
2021-07-26 20:34:17 +02:00
fi
2022-06-28 10:30:05 +02:00
fi
2021-07-26 20:34:17 +02:00
fi
}