fixes to automated release process

This commit is contained in:
Dane Springmeyer 2016-09-07 19:53:01 -07:00
parent c6c94e760e
commit b6a48ff354
2 changed files with 17 additions and 10 deletions

View file

@ -3,19 +3,21 @@
set -eu set -eu
set -o pipefail set -o pipefail
VERSION=$(git describe) if [[ -f RELEASE_VERSION.md ]]; then
VERSION=$(cat RELEASE_VERSION.md)
if [[ -d .git ]]; then
git submodule update --init
else
if [[ ! -d ./test/data ]]; then if [[ ! -d ./test/data ]]; then
echo "Downloading unit test data from https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz" echo "Downloading unit test data from https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz"
mkdir -p test/data/ mkdir -p test/data/
curl -L -s https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data/ curl -f -L -s https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data/
fi fi
if [[ ! -d ./test/data-visual ]]; then if [[ ! -d ./test/data-visual ]]; then
echo "Downloading visual test data from https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz" echo "Downloading visual test data from https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz"
mkdir -p test/data-visual/ mkdir -p test/data-visual/
curl -L -s https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data-visual/ curl -f -L -s https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz | tar zxf - --strip-components=1 -C test/data-visual/
fi fi
elif [[ -d .git ]]; then
git submodule update --init test/
else
echo "Expected either git clone directory (with .git) or release tarball with `RELEASE_VERSION.md` in root"
exit 1
fi fi

View file

@ -66,7 +66,8 @@ rm -f deps/mapbox/variant/Jamroot
function check_and_tag() { function check_and_tag() {
REPO_DIR=$1 REPO_DIR=$1
REPO_NAME=$2 REPO_NAME=$2
if [[ $(curl --fail -I https://github.com/mapnik/${REPO_NAME}/archive/${MAPNIK_VERSION}.tar.gz) ]]; then cmd="curl --fail -I https://github.com/mapnik/${REPO_NAME}/releases/tag/${MAPNIK_VERSION}"
if [[ $(${cmd}) ]]; then
step "test data already tagged, no need to initialize submodule" step "test data already tagged, no need to initialize submodule"
else else
step "tagging test data" step "tagging test data"
@ -91,13 +92,14 @@ step "removing .git and .gitignore"
rm -rf .git rm -rf .git
rm -rf .gitignore rm -rf .gitignore
export TARBALL_COMPRESSED=${TARBALL_NAME}.tar.bz2 export TARBALL_COMPRESSED=${TARBALL_NAME}.tar.bz2
echo ${MAPNIK_VERSION} > RELEASE_VERSION.md
step "creating tarball of ${TARBALL_COMPRESSED}" step "creating tarball of ${TARBALL_COMPRESSED}"
cd ../ cd ../
tar cjf ${TARBALL_COMPRESSED} ${TARBALL_NAME}/ tar cjf ${TARBALL_COMPRESSED} ${TARBALL_NAME}/
step "uploading to github" step "uploading to github"
# https://developer.github.com/v3/repos/releases/#create-a-release # https://developer.github.com/v3/repos/releases/#create-a-release
IS_PRERELEASE=false IS_PRERELEASE=false
if [[ ${MAPNIK_VERSION} =~ 'rc' ]]; then if [[ ${MAPNIK_VERSION} =~ 'rc' ]] || [[ ${MAPNIK_VERSION} =~ 'alpha' ]]; then
IS_PRERELEASE=true IS_PRERELEASE=true
fi fi
IS_DRAFT=true IS_DRAFT=true
@ -114,6 +116,8 @@ https://api.github.com/repos/mapnik/mapnik/releases?access_token=${GITHUB_TOKEN_
cat create_response.json cat create_response.json
# parse out upload url and form it up to post tarball # parse out upload url and form it up to post tarball
UPLOAD_URL=$(python -c "import json;print json.load(open('create_response.json'))['upload_url'].replace('{?name,label}','?name=${TARBALL_COMPRESSED}')") UPLOAD_URL=$(python -c "import json;print json.load(open('create_response.json'))['upload_url'].replace('{?name,label}','?name=${TARBALL_COMPRESSED}')")
HTML_URL=$(python -c "import json;print json.load(open('create_response.json'))['html_url']")
step "upload url: $UPLOAD_URL" step "upload url: $UPLOAD_URL"
# upload source tarball # upload source tarball
@ -124,7 +128,8 @@ curl ${UPLOAD_URL} \
--data-binary @${TARBALL_COMPRESSED} --data-binary @${TARBALL_COMPRESSED}
echo echo
step "Success: view your new draft release as https://github.com/mapnik/mapnik/releases" step "Success: view your new draft release at ${HTML_URL}"
open ${HTML_URL}
echo echo
#step "uploading $(realpath ${TARBALL_COMPRESSED}) to s3://mapnik/dist/${MAPNIK_VERSION}/" #step "uploading $(realpath ${TARBALL_COMPRESSED}) to s3://mapnik/dist/${MAPNIK_VERSION}/"