summarylogtreecommitdiffstats
path: root/update
blob: aa60916d8f1b3da8f13fdb412947e0c587915f57 (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
set -ex

TMPFILE=$(mktemp)
trap "rm -f ${TMPFILE}" EXIT

REPO=TimothyYe/godns
curl --silent "https://api.github.com/repos/${REPO}/releases/latest" -o "${TMPFILE}"

LATEST=$(jq ".. .tag_name? // empty" "${TMPFILE}")
LATEST=${LATEST:2:-1}

RELEASE_BODY=$(jq -r ".body" "${TMPFILE}")
RELEASE_BODY=$(printf "${RELEASE_BODY}")

sed -i 's/^\(pkgver=\)[0-9.]*$/\1'"${LATEST}"'/' PKGBUILD
updpkgsums
makepkg -s
makepkg --printsrcinfo > .SRCINFO

git diff
git commit PKGBUILD .SRCINFO -m "Upgrade to ${LATEST}" -m "${RELEASE_BODY}"