2016-09-06 09:00:37 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
# for normal release leave empty
|
|
|
|
# for release candidate, add "-rcN"
|
|
|
|
export MAPNIK_VERSION=$(git describe)
|
2016-09-06 09:26:45 +02:00
|
|
|
if [[ $(git tag -l) =~ $MAPNIK_VERSION ]]; then echo yes;
|
|
|
|
echo "Success: found $MAPNIK_VERSION (result of git describe) in tags, continuing"
|
|
|
|
else
|
|
|
|
echo "error: $MAPNIK_VERSION (result of git describe) not in "git tag -l" output, aborting"
|
|
|
|
echo "You must create a valid annotated tag first, before running this ./scripts/publish_release.sh"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-09-06 09:20:48 +02:00
|
|
|
export TARBALL_NAME="mapnik-${MAPNIK_VERSION}"
|
2016-09-06 09:00:37 +02:00
|
|
|
cd /tmp/
|
|
|
|
rm -rf ${TARBALL_NAME}
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "Cloning ${MAPNIK_VERSION}"
|
|
|
|
git clone --depth 1 --branch ${MAPNIK_VERSION} git@github.com:mapnik/mapnik.git ${TARBALL_NAME}
|
2016-09-06 09:00:37 +02:00
|
|
|
cd ${TARBALL_NAME}
|
2016-09-06 09:20:48 +02:00
|
|
|
git checkout "tags/${MAPNIK_VERSION}"
|
2016-09-06 09:00:37 +02:00
|
|
|
echo "updating submodules"
|
2016-09-06 09:20:48 +02:00
|
|
|
# TODO: skip initializing submodule if data is already tagged
|
|
|
|
# Will require bundling variant as well
|
2016-09-06 09:00:37 +02:00
|
|
|
git submodule update --depth 100 --init
|
|
|
|
rm -rf deps/mapbox/variant/.git
|
|
|
|
cd test/data/
|
|
|
|
git remote set-url origin git@github.com:mapnik/test-data
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "tagging test data"
|
|
|
|
git tag ${MAPNIK_VERSION} -a -m "tagging for ${MAPNIK_VERSION}"
|
2016-09-06 09:00:37 +02:00
|
|
|
git push --tags
|
|
|
|
cd ../../
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "removing test data submodule"
|
2016-09-06 09:00:37 +02:00
|
|
|
rm -rf test/data/
|
|
|
|
cd test/data-visual/
|
|
|
|
git remote set-url origin git@github.com:mapnik/test-data-visual
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "tagging visual data"
|
|
|
|
git tag ${MAPNIK_VERSION} -a -m "tagging for ${MAPNIK_VERSION}"
|
2016-09-06 09:00:37 +02:00
|
|
|
git push --tags
|
|
|
|
cd ../../
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "removing visual test data submodule"
|
2016-09-06 09:00:37 +02:00
|
|
|
rm -rf test/data-visual/
|
|
|
|
rm -rf .git
|
|
|
|
rm -rf .gitignore
|
|
|
|
cd ../
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "creating tarball of ${TARBALL_NAME}.tar.bz2"
|
2016-09-06 09:00:37 +02:00
|
|
|
tar cjf ${TARBALL_NAME}.tar.bz2 ${TARBALL_NAME}/
|
2016-09-06 09:20:48 +02:00
|
|
|
echo "uploading $(dirname ${TARBALL_NAME})/${TARBALL_NAME}.tar.bz2 to s3://mapnik/dist/${MAPNIK_VERSION}/"
|
|
|
|
# TODO: upload to github releases instead of s3
|
|
|
|
aws s3 cp --acl public-read ${TARBALL_NAME}.tar.bz2 s3://mapnik/dist/${MAPNIK_VERSION}/
|