diff options
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 27 |
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}" |