Moved deploy.sh to deploy-master.sh

This commit is contained in:
Dave Halter
2017-08-31 19:32:05 +02:00
parent 6a6da7ca58
commit 92f2761398

49
deploy-master.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/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)
PROJECT_NAME=parso
BRANCH=master
BUILD_FOLDER=build
FOLDER=$BUILD_FOLDER/$PROJECT_NAME
# Test first.
#tox
[ -d $BUILD_FOLDER ] || mkdir $BUILD_FOLDER
# Remove the previous deployment first.
rm -rf $FOLDER
# Checkout the right branch
cd $BUILD_FOLDER
git clone .. $PROJECT_NAME
git checkout $BRANCH
# Create tag
tag=v$(python -c "import $PROJECT_NAME; print($PROJECT_NAME.__version__)")
master_ref=$(git show-ref -s $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 $BRANCH
git push --tags
fi
# Package and upload to PyPI
rm -rf dist/
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