summarylogtreecommitdiffstats
path: root/update_version.sh
blob: fde1f474b122bc5e8044f47628163b58b383931e (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
#!/bin/bash
set -euxo pipefail

REPO="https://github.com/yggdrasil-network/yggdrasil-go.git"
WORKDIR="/tmp/yggdrasil-go"

# Set up cleanup
function cleanup() {
	rm -rf ${WORKDIR}
}
trap cleanup EXIT

# Check out latest master
git clone ${REPO} ${WORKDIR}

# Fetch version information
pushd ${WORKDIR}
VER=$(FULL=1 bash contrib/semver/version.sh | sed 's/^v//')

# Replace version in PKGBUILD
popd
sed -i \
	-e "s/^pkgver=.*$/pkgver=${VER}/" \
	-e 's/pkgrel=.*/pkgrel=1/' \
	PKGBUILD

# Check for real updates
if (git diff --exit-code PKGBUILD); then
	echo "Version ${VER} is already in PKGBUILD, not updating"
	exit 0
fi

# Update .SRCINFO
makepkg --printsrcinfo >.SRCINFO

# Create update-commit
git add PKGBUILD .SRCINFO
git commit -m "yggdrasil-go v${VER}"