From 368cd7580596a8e543da81f0698cdece3faa796f Mon Sep 17 00:00:00 2001 From: nyyu Date: Sat, 5 Aug 2023 14:40:59 +0200 Subject: [PATCH] feat(ci): autoupdate gitea --- .util.sh | 5 +++++ build.sh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/.util.sh b/.util.sh index 044549c..7be19e0 100644 --- a/.util.sh +++ b/.util.sh @@ -5,6 +5,11 @@ update_github_tag() { 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 diff --git a/build.sh b/build.sh index 296e152..4f579e7 100755 --- a/build.sh +++ b/build.sh @@ -56,6 +56,10 @@ for d in */; do if [[ -n "${repo}" ]]; then update_github_tag "${repo}" fi + repo=$(grep -oPm 1 'gitea\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO) + if [[ -n "${repo}" ]]; then + update_gitea_tag "${repo}" + fi fi update_pkg build true