aur/.util.sh

23 lines
665 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() {
2022-06-28 10:30:05 +02:00
ver=$(curl -Ls https://api.github.com/repos/"$1"/tags | jq -r '[.[] | select(.name | index("rc") | not) | select (.name | index("dev") | not)] | first | .name' | cut -c2-)
echo "${ver}" | grep -Eq "^(\w|\+|\.)+$" && sed -i "s/pkgver=.*/pkgver=${ver}/" PKGBUILD
2021-07-26 20:37:40 +02:00
}
2021-07-26 20:34:17 +02:00
update_pkg() {
2022-06-28 10:30:05 +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
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
}