2013-05-24 19:04:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-10-28 21:18:33 +00:00
|
|
|
set -e
|
|
|
|
|
2013-05-24 19:04:06 +00:00
|
|
|
TAG=$1
|
|
|
|
|
|
|
|
if [ -z $TAG ]; then
|
|
|
|
echo "Please specify a tag"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-10-29 17:11:44 +00:00
|
|
|
if [ -f geoip2.phar ]; then
|
|
|
|
rm geoip2.phar
|
|
|
|
fi
|
2014-10-28 21:18:33 +00:00
|
|
|
|
2013-05-24 19:04:06 +00:00
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
|
|
echo ". is not clean." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-10-28 21:18:33 +00:00
|
|
|
if [ -d vendor ]; then
|
|
|
|
rm -fr vendor
|
|
|
|
fi
|
|
|
|
|
|
|
|
php composer.phar self-update
|
|
|
|
php composer.phar update --no-dev
|
|
|
|
|
2014-12-04 01:15:50 +00:00
|
|
|
if [ ! -f box.phar ]; then
|
|
|
|
wget -O box.phar "https://github.com/box-project/box2/releases/download/2.5.0/box-2.5.0.phar"
|
|
|
|
fi
|
|
|
|
|
|
|
|
php box.phar build
|
2014-12-03 15:10:46 +00:00
|
|
|
|
|
|
|
PHAR_TEST=$(./dev-bin/phar-test.php)
|
|
|
|
if [[ -n $PHAR_TEST ]]; then
|
|
|
|
echo "Phar test outputed non-empty string: $PHAR_TEST"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-03 14:59:16 +00:00
|
|
|
|
|
|
|
# Download test deps
|
2014-10-28 21:18:33 +00:00
|
|
|
php composer.phar update
|
|
|
|
|
|
|
|
./vendor/bin/phpunit
|
|
|
|
|
2013-05-24 19:04:06 +00:00
|
|
|
if [ ! -d .gh-pages ]; then
|
|
|
|
echo "Checking out gh-pages in .gh-pages"
|
|
|
|
git clone -b gh-pages git@git.maxmind.com:GeoIP2-php .gh-pages
|
2014-10-28 21:18:33 +00:00
|
|
|
pushd .gh-pages
|
2013-05-24 19:04:06 +00:00
|
|
|
else
|
2013-05-24 19:05:52 +00:00
|
|
|
echo "Updating .gh-pages"
|
2014-10-28 21:18:33 +00:00
|
|
|
pushd .gh-pages
|
2013-05-24 19:04:06 +00:00
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
|
|
echo ".gh-pages is not clean" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-10-28 21:18:33 +00:00
|
|
|
# We no longer have apigen as a dependency in Composer as releases are
|
|
|
|
# sporadically deleted upstream and compatibility is often broken on patch
|
|
|
|
# releases.
|
|
|
|
if [ ! -f apigen.phar ]; then
|
|
|
|
wget -O apigen.phar "https://github.com/apigen/apigen/releases/download/v4.0.0-RC3/apigen-4.0.0-RC3.phar"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cat <<EOF > apigen.neon
|
2014-10-29 17:11:44 +00:00
|
|
|
destination: doc/$TAG
|
2014-10-28 21:18:33 +00:00
|
|
|
|
|
|
|
source:
|
2014-10-29 17:11:44 +00:00
|
|
|
- ../src
|
2014-10-28 21:18:33 +00:00
|
|
|
|
|
|
|
title: "GeoIP2 PHP API $TAG"
|
|
|
|
EOF
|
|
|
|
|
2014-10-29 17:11:44 +00:00
|
|
|
php apigen.phar generate
|
2014-10-28 21:18:33 +00:00
|
|
|
|
2013-05-25 02:35:47 +00:00
|
|
|
|
2013-05-25 02:37:10 +00:00
|
|
|
PAGE=index.md
|
2013-05-25 02:35:47 +00:00
|
|
|
cat <<EOF > $PAGE
|
|
|
|
---
|
|
|
|
layout: default
|
|
|
|
title: MaxMind GeoIP2 PHP API
|
|
|
|
language: php
|
|
|
|
version: $TAG
|
|
|
|
---
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2013-05-25 02:37:10 +00:00
|
|
|
cat ../README.md >> $PAGE
|
2013-05-24 19:04:06 +00:00
|
|
|
|
|
|
|
git add doc/
|
2013-05-24 21:30:51 +00:00
|
|
|
git commit -m "Updated for $TAG" -a
|
2013-05-24 19:04:06 +00:00
|
|
|
|
|
|
|
read -e -p "Push to origin? " SHOULD_PUSH
|
|
|
|
|
|
|
|
if [ "$SHOULD_PUSH" != "y" ]; then
|
|
|
|
echo "Aborting"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-05-24 20:12:45 +00:00
|
|
|
# If we don't push directly to github, the page doesn't get built for some
|
|
|
|
# reason.
|
|
|
|
git push git@github.com:maxmind/GeoIP2-php.git
|
2013-05-24 19:04:06 +00:00
|
|
|
git push
|
2013-05-24 20:12:45 +00:00
|
|
|
|
2014-10-28 21:18:33 +00:00
|
|
|
popd
|
|
|
|
|
2013-07-16 19:40:34 +00:00
|
|
|
git tag -a $TAG
|
2013-05-24 19:04:06 +00:00
|
|
|
git push
|
|
|
|
git push --tags
|