summarylogtreecommitdiffstats
path: root/check-and-update-new-version.sh
blob: 4731535f3fbaa5ce56a039a8cb646c7953ad950d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

touch lastVersion
lastVersion=`cat lastVersion`
currentVersion=`curl https://www.mkgmap.org.uk/download/mkgmap.html --silent | grep "Download mkgmap release" | sed -rn 's/.*([[:digit:]][[:digit:]][[:digit:]][[:digit:]]).*/\1/p'`

if [ -z "${currentVersion}" ]; then
    echo "mkgmap.org.uk is down or the version number could not be parsed"
    exit -1
fi

if [ "${lastVersion}" = "${currentVersion}" ]; then
    exit 0
fi

sed -i "s/pkgver=.*/pkgver=${currentVersion}/g" PKGBUILD
updpkgsums
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "release version ${currentVersion}"
git push

echo $currentVersion > lastVersion

rm "mkgmap-r${currentVersion}.zip"