summarylogtreecommitdiffstats
path: root/release
blob: b11feca512d32469bf39746f4c9002d46da7e7ed (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /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; }
command -v mullvad-toggle >/dev/null && {
  if is-mullvad; then
    mullvad-toggle
    sleep 5s
  fi
}

VERSION="$1"
CHECKSUMS_FILE="checksums-$VERSION.txt"

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

# get checksums
SUM="$(wget "http://registry.npmjs.org/webpack/-/webpack-$VERSION.tgz" -qO - 2>/dev/null | sha256sum | cut -d\  -f1 | tr -d '\n')"

# upate shasums
sed -r "s/sha256sums=\([\"'][^\"']+[\"']\)$/sha256sums=(\"$SUM\")/" PKGBUILD -i

# regenerate .SRCINFO
makepkg -f && makepkg --printsrcinfo > .SRCINFO

# sanity check
namcap PKGBUILD
namcap *.pkg.tar.zst

# check changes
git --no-pager diff PKGBUILD

# cleanup temp
rm -r src pkg *.tar*

git status
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