summarylogtreecommitdiffstats
path: root/release
blob: 87ff182264dfc275d4e22e685272a2e5613afb22 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh

if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "help" ] || [ -z "$1" ]; then
  cat <<EOF
$ release VERSION
Prepare a new version for release

Parameters:
  \$1: version number of new release

Example:
  $ release 1337
EOF
  exit
fi

command -v wget >/dev/null || { echo "wget is not installed" 1>&2; exit 127; }
command -v makepkg >/dev/null || { echo "makepkg was not found" 1>&2; exit 127; }
command -v git >/dev/null || { echo "git is not installed" 1>&2; exit 127; }

VERSION="$1"

# update version
sed -r "s/^pkgver=.*$/pkgver=\"$VERSION\"/g" PKGBUILD -i

# update shasum
SUM=$(wget -q "https://download.opensuse.org/repositories/home:/selmf/Debian_Unstable/amd64/yacreader_$VERSION-1_amd64.deb" -O - | sha256sum - | cut -d\  -f1)
sed -r "s/sha256sums_x86_64=\([\"'][^\"']+[\"']\)$/sha256sums_x86_64=(\"$SUM\")/" PKGBUILD -i

# regenerate .SRCINFO
makepkg -f && makepkg --printsrcinfo >.SRCINFO
rm -r src pkg *.tar* *.deb 2>/dev/null

git --no-pager diff PKGBUILD
git status -s
printf "Commit and push changes? (Y/n): "
read ans
if [ "$ans" != "n" ] && [ "$ans" != "N" ]; then
  git add -A
  git commit -m "Release $VERSION"
  git push origin master
fi