forked from Yubico/php-u2flib-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do-source-release.sh
executable file
·40 lines (33 loc) · 956 Bytes
/
do-source-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
#!/bin/sh
set -e
VERSION=$1
PGP_KEYID=$2
if [ "x$PGP_KEYID" = "x" ]; then
echo "try with $0 VERSION PGP_KEYID"
echo "example: $0 0.0.1 B2168C0A"
exit
fi
if ! head -3 NEWS | grep -q "Version $VERSION .released `date -I`"; then
echo "You need to update date/version in NEWS"
exit
fi
if [ "x$YUBICO_GITHUB_REPO" = "x" ]; then
echo "you need to define YUBICO_GITHUB_REPO"
exit
fi
releasename=php-u2flib-server-${VERSION}
git push
git tag -u ${PGP_KEYID} -m $VERSION $VERSION
git push --tags
tmpdir=`mktemp -d /tmp/release.XXXXXX`
releasedir=${tmpdir}/${releasename}
mkdir -p $releasedir
git archive $VERSION --format=tar | tar -xC $releasedir
git2cl > $releasedir/ChangeLog
cd $releasedir
apigen generate
cd -
tar -cz --directory=$tmpdir --file=${releasename}.tar.gz $releasename
gpg --detach-sign --default-key $PGP_KEYID ${releasename}.tar.gz
$YUBICO_GITHUB_REPO/publish php-u2flib-server $VERSION ${releasename}.tar.gz*
rm -rf $tmpdir