summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Wehner2023-10-07 15:57:17 -0400
committerFlorian Wehner2023-10-07 15:57:56 -0400
commit43025e4312291fc4933d84ca3ca5e59b7391f321 (patch)
tree956c251c03eb975259bd721337672e74382c4b77
parent9fc3f567732ada8a118a29793c6d077c89089f0e (diff)
downloadaur-43025e4312291fc4933d84ca3ca5e59b7391f321.tar.gz
Refactored the update.sh script
Changed to be a bit streamlined and reset the release to 1 when there is an update on the source repo. Reason: pkgrel changes are usually manual interventions when something brok ein the same version.
-rwxr-xr-xupdate.sh27
1 files changed, 14 insertions, 13 deletions
diff --git a/update.sh b/update.sh
index 163475b90607..f81fccaff1cf 100755
--- a/update.sh
+++ b/update.sh
@@ -1,18 +1,19 @@
VERSION=$(curl -sL https://api.github.com/repos/buchen/portfolio/releases/latest | jq -r .tag_name)
+CURRENT_VERSION=$(grep 'pkgver=' PKGBUILD | cut -d'=' -f2)
-sed -i -e 's/pkgver=.*/pkgver='$VERSION'/' PKGBUILD
+# If GitHub's version is different from the current version, update the PKGBUILD file
+if [[ $VERSION != $CURRENT_VERSION ]]; then
+ echo "Updating PKGBUILD to version $VERSION..."
+ sed -i -e 's/pkgver=.*/pkgver='$VERSION'/' PKGBUILD
+ sed -i -e 's/pkgrel=.*/pkgrel=1/' PKGBUILD
-updpkgsums
+ updpkgsums
+ makepkg --printsrcinfo > .SRCINFO
-# Check whether this changed anything
-if (git diff --exit-code PKGBUILD); then
- echo "Package ${PKG} has most recent version ${VER}"
- exit 0
+ git add PKGBUILD .SRCINFO
+ git commit -m "feat: update to v${VERSION}"
+ echo "Update complete!"
+else
+ echo "Current version ($CURRENT_VERSION) is up-to-date."
+ exit 0
fi
-
-# Update .SRCINFO
-makepkg --printsrcinfo > .SRCINFO
-
-# Commit changes
-git add PKGBUILD .SRCINFO
-git commit -m "feat: update to v${VERSION}"