From 3789709ec086b1191fcc76eed788aa04c5054d4d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 31 Aug 2017 22:45:27 +0200 Subject: [PATCH] Add the deployment script from parso. --- deploy-master.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ deploy.sh | 13 ------------ 2 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 deploy-master.sh delete mode 100755 deploy.sh diff --git a/deploy-master.sh b/deploy-master.sh new file mode 100644 index 00000000..cea74486 --- /dev/null +++ b/deploy-master.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# The script creates a separate folder in build/ and creates tags there, pushes +# them and then uploads the package to PyPI. + +set -eu -o pipefail + +BASE_DIR=$(dirname $(readlink -f "$0")) +cd $BASE_DIR + +git fetch --tags + +PROJECT_NAME=jedi +BRANCH=master +BUILD_FOLDER=build + +[ -d $BUILD_FOLDER ] || mkdir $BUILD_FOLDER +# Remove the previous deployment first. +# Checkout the right branch +cd $BUILD_FOLDER +rm -rf $PROJECT_NAME +git clone .. $PROJECT_NAME +cd $PROJECT_NAME +git checkout $BRANCH + +# Test first. +tox + +# Create tag +tag=v$(python -c "import $PROJECT_NAME; print($PROJECT_NAME.__version__)") + +master_ref=$(git show-ref -s heads/$BRANCH) +tag_ref=$(git show-ref -s $tag || true) +if [[ $tag_ref ]]; then + if [[ $tag_ref != $master_ref ]]; then + echo 'Cannot tag something that has already been tagged with another commit.' + exit 1 + fi +else + git tag $tag + git push --tags +fi + +# Package and upload to PyPI +#rm -rf dist/ - Not needed anymore, because the folder is never reused. +echo `pwd` +python setup.py sdist bdist_wheel +# Maybe do a pip install twine before. +twine upload dist/* + +cd $BASE_DIR +# Back in the development directory fetch tags. +git fetch --tags diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index f7aadcda..00000000 --- a/deploy.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -eu -o pipefail - -# Create tag -git tag $(python -c 'import jedi; print(jedi.__version__)') -git push --tags - -# Package and upload to PyPI -rm -rf dist/ -python setup.py sdist bdist_wheel -# Maybe do a pip install twine before. -twine upload dist/*