summarylogtreecommitdiffstats
path: root/update.sh
blob: 777b97ca160e8661f0dbd83a3b60396547e7cc56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
read -r LOCALVER <<<"$(cat PKGBUILD | grep 'pkgver=' | sed 's/pkgver=//g')"
read -r UPSTREAMVER <<<"$(wget --quiet https://www.npmjs.com/package/markmap-cli/v/latest -O /dev/stdout | grep -Eo '[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}<!-- --> • ' | head -1 | sed 's/<.*//g')"

if [ "$LOCALVER" == "$UPSTREAMVER" ]; then
	echo "No update available"
	exit 0
fi

echo "New version available: $UPSTREAMVER"
if [[ $* == *--dry-run* ]]; then
	exit 0
fi

sed -i "s/pkgver=.*/pkgver=$UPSTREAMVER/g" PKGBUILD
echo "Updated version to $UPSTREAMVER"

updpkgsums
makepkg --printsrcinfo >.SRCINFO
git add ./PKGBUILD ./.SRCINFO
git commit -m "Version $UPSTREAMVER"
git push && git push aur master