Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit dc3d6e0

Browse files
committed
Add release script
1 parent 70d38bb commit dc3d6e0

File tree

2 files changed

+67
-17
lines changed

2 files changed

+67
-17
lines changed

README.dev.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
## Releasing
22

33
* Make sure the `ChangeLog` is up to date.
4-
* Edit `configure.ac` and bump the version
5-
* Run the following:
6-
7-
./bootstrap
8-
./configure
9-
make check -j 4
10-
sudo make install
11-
12-
* `make dist`
13-
* Check that you can untar this release and install it
14-
* `git tag v{X.Y.Z}`
15-
* `git push --tags`
16-
* Make a new release on GitHub at https://github.com/maxmind/geoip-api-c/releases
17-
* Upload the tarball you just made
18-
* Edit said release to include the changes for this release on GitHub
19-
4+
* Run `dev-bin/release.sh`
205

216
## Ubuntu PPA packages
227

@@ -26,7 +11,7 @@ Release script:
2611

2712
1. run `dev-bin/ppa-release.sh`
2813

29-
Manual process:
14+
Manual PPA process:
3015

3116
1. Type `dch -i` and add the appropriate `debian/changelog` entry.
3217
2. Move tarball created above to a temp directory and

dev-bin/release.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
set -eu -o pipefail
4+
5+
changelog=$(cat ChangeLog)
6+
7+
regex='([0-9]+\.[0-9]+\.[0-9]+) ([0-9]{4}-[0-9]{2}-[0-9]{2})
8+
9+
((.|
10+
)*)
11+
'
12+
13+
if [[ ! $changelog =~ $regex ]]; then
14+
echo "Could not find date line in change log!"
15+
exit 1
16+
fi
17+
18+
version="${BASH_REMATCH[1]}"
19+
date="${BASH_REMATCH[2]}"
20+
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
21+
22+
dist="GeoIP-$version.tar.gz"
23+
24+
if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
25+
echo "$date is not today!"
26+
exit 1
27+
fi
28+
29+
if [ -n "$(git status --porcelain)" ]; then
30+
echo ". is not clean." >&2
31+
# exit 1
32+
fi
33+
34+
perl -pi -e "s/(?<=AC_INIT\(\[GeoIP\], \[)(\d+\.\d+\.\d+)(?=])/$version/gsm" configure.ac
35+
36+
if [ -n "$(git status --porcelain)" ]; then
37+
git add configure.ac
38+
git commit -m "Bumped version to $version"
39+
fi
40+
41+
./bootstrap
42+
./configure
43+
make
44+
make check
45+
make clean
46+
make dist
47+
48+
read -p "Push to origin? (y/n) " should_push
49+
50+
if [ "$should_push" != "y" ]; then
51+
echo "Aborting"
52+
exit 1
53+
fi
54+
55+
git push
56+
57+
popd
58+
59+
git push
60+
61+
message="$version
62+
63+
$notes"
64+
65+
hub release create -a "$dist" -m "$message" "v$version"

0 commit comments

Comments
 (0)