-
Notifications
You must be signed in to change notification settings - Fork 25
/
release.sh
executable file
·65 lines (54 loc) · 1.9 KB
/
release.sh
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
60
61
62
63
64
#!/usr/bin/env bash
set -x
version="$(git describe)"
git clean -xdf
key="${SIGNER:-jeff@lokinet.io}"
_build_release()
{
exe="$1"
builddir="$2"
key="$3"
for os in linux freebsd ; do
for arch in amd64 arm ppc64 ; do
export XD=$builddir/$exe-$os-$arch
GOOS=$os GOARCH=$arch make clean $XD && gpg -u $key --sign --detach $XD
done
done
export XD=$builddir/$exe-darwin
GOOS=darwin GOARCH=amd64 make clean $XD && gpg -u $key --sign --detach $XD
export XD=$builddir/$exe-windows.exe
GOOS=windows GOARCH=amd64 make clean $XD && gpg -u $key --sign --detach $XD
}
export GIT_VERSION=""
build=XD-$version
mkdir -p $build
# build i2p version
export LOKINET=0
_build_release XD-i2p-$version $build $key
# build lokinet version
export LOKINET=1
_build_release XD-lokinet-$version $build $key
# verify sigs and makes hashes
for sig in $build/*.sig ; do
gpg --verify $sig && b2sum -b $(echo $sig | sed s/\\.sig//) >> $build/HASHES.txt
done
# check hashes
b2sum -c $build/HASHES.txt || exit 1
rm -f $build/README.txt
echo "To verify the integrity of XD $version use:" >> $build/README.txt
echo "gpg --verify XD-$version.tar.xz.sig && tar -xJvf XD-$version.tar.xz && b2sum -c $build/HASHES.txt" >> $build/README.txt
echo "" >> $build/README.txt
echo "release hashes:" >> $build/README.txt
echo "" >> $build/README.txt
cat $build/HASHES.txt >> $build/README.txt
gpg -u $key --clearsign --detach $build/README.txt
mv $build/README.txt.asc $build/README.txt
# make release tarball
tar -cJvf XD-$version.tar.xz $build
gpg -u $key --sign --detach XD-$version.tar.xz
# make preformatted release notes
echo '```' >> notes-$version
cat $build/README.txt >> notes-$version
echo '```' >> notes-$version
# verify sig and upload release
gpg --verify XD-$version.tar.xz.sig && gh release create --notes "XD $version" -R majestrate/XD -F notes-$version $version XD-$version.tar.xz{,.sig}