Only update AUR git package on release if PKGBUILD has changed

This commit is contained in:
timvisee 2019-03-26 14:06:26 +01:00
parent e6118122d5
commit a5f3086dcf
No known key found for this signature in database
GPG key ID: B8DB720BC383E172

View file

@ -290,6 +290,10 @@ package-aur:
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD
- sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN')/" -i ffsend-bin/PKGBUILD - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN')/" -i ffsend-bin/PKGBUILD
# Get SHA hash for local and remote file w/o version, update if it has changed
- 'PKGBUILD_STRIP_LOCAL=$(cat ffsend-git/PKGBUILD | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
- 'PKGBUILD_STRIP_REMOTE=$(curl -sSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ffsend-git" | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)'
# Install dependencies # Install dependencies
- echo "Installing required build packages..." - echo "Installing required build packages..."
- pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl - pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl
@ -305,11 +309,16 @@ package-aur:
- echo "Making main source package..." - echo "Making main source package..."
- sudo -u nobody makepkg -c - sudo -u nobody makepkg -c
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO - sudo -u nobody makepkg --printsrcinfo > .SRCINFO
# TODO: only do this if the file has changed? # Make git package if different than the remote
- cd ../ffsend-git - |
- echo "Making git source package..." if [ ! "$PKGBUILD_STRIP_LOCAL" == "$PKGBUILD_STRIP_REMOTE" ]; then
- sudo -u nobody makepkg -c cd ../ffsend-git
- sudo -u nobody makepkg --printsrcinfo > .SRCINFO echo "Making git source package..."
sudo -u nobody makepkg -c
sudo -u nobody makepkg --printsrcinfo > .SRCINFO
else
echo "Not making git source package, it has not changed"
fi
- cd .. - cd ..
# Set up SSH for publishing # Set up SSH for publishing
@ -345,13 +354,18 @@ package-aur:
- cd .. - cd ..
# Publish git package: clone AUR repo, commit update and push # Publish git package: clone AUR repo, commit update and push
# TODO: only push here if things have changed! # Only publish it if it is different than the remote
- git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-git - |
- cd aur-ffsend-git if [ ! "$PKGBUILD_STRIP_LOCAL" == "$PKGBUILD_STRIP_REMOTE" ]; then
- cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./ git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend-git
- git add PKGBUILD .SRCINFO cd aur-ffsend-git
- git commit -m "Update PKGBUILD for release v$VERSION" cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./
- git push git add PKGBUILD .SRCINFO
- cd .. git commit -m "Update PKGBUILD for release v$VERSION"
git push
cd ..
else
echo "Not pushing git package, it has not changed"
fi
# TODO: add job to test ffsend{-git} AUR packages # TODO: add job to test ffsend{-git} AUR packages