Only push to major branch on actual releases.
Ie - not dev releases.
#!/bin/sh
-set -e
+set -euo pipefail
VERSION=`python setup.py --version`
MAJOR_BRANCH="`python setup.py --version | cut -d'.' -f1`.x"
-echo "# Releasing pyinfra v${VERSION} (branch ${MAJOR_BRANCH})"
+IS_DEV=false
+if [[ `python setup.py --version` =~ "dev" ]]; then
+ IS_DEV=true
+fi
+
+echo "# Releasing pyinfra v${VERSION} (branch ${MAJOR_BRANCH}, dev=${IS_DEV})"
echo "# Running tests..."
pytest
@@ -14,18 +19,21 @@ echo "# Git tag & push..."
git tag -a "v$VERSION" -m "v$VERSION"
git push --tags
+if [[ "${IS_DEV}" == "false" ]]; then
echo "Git update major branch..."
git checkout $MAJOR_BRANCH
git merge master
git push
git checkout master
+else
+ echo "Skipping major branch due to dev release"
+fi
-echo "# Upload to pypi..."
-# Clear build & dist
+echo "Clear existing build/dist..."
rm -rf build/* dist/*
-# Build source and wheel packages
+echo "Build source and wheel packages..."
python setup.py sdist bdist_wheel
-# Upload w/Twine
+echo "Upload w/Twine..."
twine upload dist/*
echo "# All done!"
