-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
changelog=$(cat CHANGELOG.md) | ||
|
||
regex=' | ||
([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\) | ||
-* | ||
((.| | ||
)*) | ||
' | ||
|
||
if [[ ! $changelog =~ $regex ]]; then | ||
echo "Could not find date line in change log!" | ||
exit 1 | ||
fi | ||
|
||
version="${BASH_REMATCH[1]}" | ||
date="${BASH_REMATCH[2]}" | ||
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')" | ||
|
||
if [[ "$date" -ne $(date +"%Y-%m-%d") ]]; then | ||
echo "$date is not today!" | ||
exit 1 | ||
fi | ||
|
||
tag="v$version" | ||
|
||
rm -fr vendor | ||
|
||
perl -pi -e "s/(?<=#define PHP_MAXMINDDB_VERSION \")\d+\.\d+\.\d+(?=\")/$version/" ext/php_maxminddb.h | ||
|
||
php composer.phar update | ||
|
||
./vendor/bin/phpunit | ||
|
||
php composer.phar self-update | ||
php composer.phar update --no-dev | ||
|
||
|
||
echo $'\nDiff:' | ||
git diff | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
git commit -m "Bumped version to $version" -a | ||
fi | ||
|
||
echo $'\nRelease notes:' | ||
echo "$notes" | ||
|
||
|
||
read -p "Push to origin? (y/n) " SHOULD_PUSH | ||
|
||
if [ "$SHOULD_PUSH" != "y" ]; then | ||
echo "Aborting" | ||
exit 1 | ||
fi | ||
|
||
echo "Creating tag $tag" | ||
|
||
message="$version | ||
$notes" | ||
|
||
hub release create -m "$message" "$tag" | ||
|
||
git push | ||
git push --tags |