From b6a48ff354a94cdcd80d122fc58f716f5c153732 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 7 Sep 2016 19:53:01 -0700 Subject: [PATCH] fixes to automated release process --- scripts/ensure_test_data.sh | 16 +++++++++------- scripts/publish_release.sh | 11 ++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/ensure_test_data.sh b/scripts/ensure_test_data.sh index e124f3daa..312a9aa03 100755 --- a/scripts/ensure_test_data.sh +++ b/scripts/ensure_test_data.sh @@ -3,19 +3,21 @@ set -eu set -o pipefail -VERSION=$(git describe) - -if [[ -d .git ]]; then - git submodule update --init -else +if [[ -f RELEASE_VERSION.md ]]; then + VERSION=$(cat RELEASE_VERSION.md) if [[ ! -d ./test/data ]]; then echo "Downloading unit test data from https://github.com/mapnik/test-data/archive/${VERSION}.tar.gz" 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 if [[ ! -d ./test/data-visual ]]; then echo "Downloading visual test data from https://github.com/mapnik/test-data-visual/archive/${VERSION}.tar.gz" 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 +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 \ No newline at end of file diff --git a/scripts/publish_release.sh b/scripts/publish_release.sh index c1459ecc1..7ff874996 100755 --- a/scripts/publish_release.sh +++ b/scripts/publish_release.sh @@ -66,7 +66,8 @@ rm -f deps/mapbox/variant/Jamroot function check_and_tag() { REPO_DIR=$1 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" else step "tagging test data" @@ -91,13 +92,14 @@ step "removing .git and .gitignore" rm -rf .git rm -rf .gitignore export TARBALL_COMPRESSED=${TARBALL_NAME}.tar.bz2 +echo ${MAPNIK_VERSION} > RELEASE_VERSION.md step "creating tarball of ${TARBALL_COMPRESSED}" cd ../ tar cjf ${TARBALL_COMPRESSED} ${TARBALL_NAME}/ step "uploading to github" # https://developer.github.com/v3/repos/releases/#create-a-release IS_PRERELEASE=false -if [[ ${MAPNIK_VERSION} =~ 'rc' ]]; then +if [[ ${MAPNIK_VERSION} =~ 'rc' ]] || [[ ${MAPNIK_VERSION} =~ 'alpha' ]]; then IS_PRERELEASE=true fi IS_DRAFT=true @@ -114,6 +116,8 @@ https://api.github.com/repos/mapnik/mapnik/releases?access_token=${GITHUB_TOKEN_ cat create_response.json # 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}')") +HTML_URL=$(python -c "import json;print json.load(open('create_response.json'))['html_url']") + step "upload url: $UPLOAD_URL" # upload source tarball @@ -124,7 +128,8 @@ curl ${UPLOAD_URL} \ --data-binary @${TARBALL_COMPRESSED} 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 #step "uploading $(realpath ${TARBALL_COMPRESSED}) to s3://mapnik/dist/${MAPNIK_VERSION}/"