Skip to content

Commit 2a127e4

Browse files
committed
Update release script
1 parent 39e647f commit 2a127e4

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ format that stores data indexed by IP address subnets (IPv4 or IPv6).
77

88
## Installation ##
99

10-
### Define Your Dependencies ###
10+
### Maven ###
1111

1212
We recommend installing this package with [Maven](http://maven.apache.org/).
1313
To do this, add the dependency to your pom.xml:
@@ -20,6 +20,19 @@ To do this, add the dependency to your pom.xml:
2020
</dependency>
2121
```
2222

23+
### Gradle ###
24+
25+
Add the following to your `build.gradle` file:
26+
27+
```
28+
repositories {
29+
mavenCentral()
30+
}
31+
dependencies {
32+
compile 'ccom.maxmind.db:maxmind-db:1.2.1'
33+
}
34+
```
35+
2336
## Usage ##
2437

2538
*Note:* For accessing MaxMind GeoIP2 databases, we generally recommend using

dev-bin/release.sh

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
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+
-*
10+
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+
24+
if [[ "$date" -ne $(date +"%Y-%m-%d") ]]; then
25+
echo "$date is not today!"
26+
exit 1
27+
fi
28+
29+
tag="v$version"
1530

1631
if [ -n "$(git status --porcelain)" ]; then
1732
echo ". is not clean." >&2
@@ -20,21 +35,21 @@ fi
2035

2136
mvn versions:display-dependency-updates
2237

23-
read -e -p "Continue given above dependencies? (y/n) " SHOULD_CONTINUE
38+
read -e -p "Continue given above dependencies? (y/n) " should_continue
2439

25-
if [ "$SHOULD_CONTINUE" != "y" ]; then
40+
if [ "$should_continue" != "y" ]; then
2641
echo "Aborting"
2742
exit 1
2843
fi
2944

30-
export VERSION
31-
perl -pi -e 's/(?<=<version>)[^<]*/$ENV{VERSION}/' README.md
45+
perl -pi -e "s/(?<=<version>)[^<]*/$version/" README.md
46+
perl -pi -e "s/(?<=com\.maxmind\.db\:maxmind-db\:)\d+\.\d+\.\d+([\w\-]+)?/$version/" README.md
3247

3348
if [ -n "$(git status --porcelain)" ]; then
3449
git diff
3550

36-
read -e -p "Commit README.md changes? " SHOULD_COMMIT
37-
if [ "$SHOULD_COMMIT" != "y" ]; then
51+
read -e -p "Commit README.md changes? " should_commit
52+
if [ "$should_commit" != "y" ]; then
3853
echo "Aborting"
3954
exit 1
4055
fi
@@ -45,17 +60,23 @@ fi
4560

4661
# could be combined with the primary build
4762
mvn release:clean
48-
mvn release:prepare -DreleaseVersion="$VERSION" -Dtag="$TAG"
63+
mvn release:prepare -DreleaseVersion="$version" -Dtag="$tag"
4964
mvn release:perform
5065

51-
read -e -p "Push to origin? " SHOULD_PUSH
66+
read -e -p "Push to origin? " should_push
5267

53-
if [ "$SHOULD_PUSH" != "y" ]; then
68+
if [ "$should_push" != "y" ]; then
5469
echo "Aborting"
5570
exit 1
5671
fi
5772

5873
git push
5974
git push --tags
6075

76+
message="$version
77+
78+
$notes"
79+
80+
hub release create -m "$message" "$tag"
81+
6182
echo "Remember to do the release on https://oss.sonatype.org/!"

0 commit comments

Comments
 (0)