From 87d72c0f6cf726764a1cf8aebc527c64d46cecfb Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 9 Aug 2018 17:28:35 -0700 Subject: [PATCH] Misc release script improvements Signed-off-by: Joffrey F --- scripts/release.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index f36efff9..5b37b6d0 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -22,7 +22,15 @@ echo "##> Removing stale build files" rm -rf ./build || exit 1 echo "##> Tagging the release as $VERSION" -git tag $VERSION || exit 1 +git tag $VERSION +if [[ $? != 0 ]]; then + head_commit=$(git show --pretty=format:%H HEAD) + tag_commit=$(git show --pretty=format:%H $VERSION) + if [[ $head_commit != $tag_commit ]]; then + echo "ERROR: tag already exists, but isn't the current HEAD" + exit 1 + fi +fi if [[ $2 == 'upload' ]]; then echo "##> Pushing tag to github" git push $GITHUB_REPO $VERSION || exit 1 @@ -30,10 +38,10 @@ fi pandoc -f markdown -t rst README.md -o README.rst || exit 1 +echo "##> sdist & wheel" +python setup.py sdist bdist_wheel + if [[ $2 == 'upload' ]]; then - echo "##> Uploading sdist to pypi" - python setup.py sdist bdist_wheel upload -else - echo "##> sdist & wheel" - python setup.py sdist bdist_wheel -fi + echo '##> Uploading sdist to pypi' + twine upload dist/docker-$VERSION* +fi \ No newline at end of file