Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 425777d

Browse files
committed
Update release script
1 parent 7fdeb9f commit 425777d

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

dev-bin/release.sh

+41-17
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,70 @@
11
#!/bin/bash
22

3-
set -e
3+
set -eu -o pipefail
44

5-
VERSION=$(perl -MFile::Slurp::Tiny=read_file -MDateTime <<EOF
6-
use v5.16;
7-
my \$log = read_file(q{ChangeLog.md});
8-
\$log =~ /\n(\d+\.\d+\.\d+) \((\d{4}-\d{2}-\d{2})\)\n/;
9-
die 'Release time is not today!' unless DateTime->now->ymd eq \$2;
10-
say \$1;
11-
EOF
12-
)
5+
changelog=$(cat ChangeLog.md)
136

14-
TAG="v$VERSION"
7+
regex='
8+
([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
9+
-*
1510
16-
git pull
11+
((.|
12+
)*)
13+
'
14+
15+
if [[ ! $changelog =~ $regex ]]; then
16+
echo "Could not find date line in change log!"
17+
exit 1
18+
fi
19+
20+
version="${BASH_REMATCH[1]}"
21+
date="${BASH_REMATCH[2]}"
22+
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
23+
dist="geoipupdate-$version.tar.gz"
24+
25+
if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
26+
echo "$date is not today!"
27+
exit 1
28+
fi
29+
30+
tag="v$version"
1731

1832
if [ -n "$(git status --porcelain)" ]; then
1933
echo ". is not clean." >&2
2034
exit 1
2135
fi
2236

23-
export VERSION
24-
perl -pi -e "s/(?<=^AC_INIT\(\[geoipupdate\], \[).+?(?=\])/$VERSION/g" configure.ac
37+
git pull
38+
39+
perl -pi -e "s/(?<=^AC_INIT\(\[geoipupdate\], \[).+?(?=\])/$version/g" configure.ac
2540

2641
./bootstrap
2742
./configure
2843
make clean
2944
make dist
3045

46+
echo "Diff:"
47+
3148
git diff
3249

33-
read -e -p "Push to origin? " SHOULD_PUSH
50+
echo "Release notes:"
51+
echo "$notes"
52+
53+
read -e -r -p "Push to origin? " SHOULD_PUSH
3454

3555
if [ "$SHOULD_PUSH" != "y" ]; then
3656
echo "Aborting"
3757
exit 1
3858
fi
3959

40-
git commit -m "Update version number for $TAG" -a
60+
git commit -m "Bump version to $version" -a
4161

42-
git tag -a "$TAG"
4362
git push
44-
git push --tags
63+
64+
message="$version
65+
66+
$notes"
67+
68+
hub release create -a "$dist" -m "$message" "$tag"
4569

4670
echo "Release to PPA and Homebrew"

0 commit comments

Comments
 (0)