X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=cut_version.sh;h=efad099883eee317139a34bed92bf5afb42d6f2d;hb=128333be9c3124daa6f026ffbc42c54a7ea1baa0;hp=0f477daa9993439838909c31c42dc1a703203ac1;hpb=69566c003b4f1c3a4905f37d3735d7921502d14a;p=pyutils.git diff --git a/cut_version.sh b/cut_version.sh index 0f477da..efad099 100755 --- a/cut_version.sh +++ b/cut_version.sh @@ -42,13 +42,18 @@ if [ $# -ne 1 ]; then fi VERSION=$1 -if ! ask_y_n "About to cut and upload $VERSION, ok?" "N"; then +PREVIOUS_VERSION=$(git tag --sort=-creatordate | head -1) +git tag --format='%(creatordate:short)%09%(refname:strip=2)' +echo +echo "PREVIOUS_VERSION=${PREVIOUS_VERSION}" +echo +if ! ask_y_n "About to cut (build, test, package, give you the command to upload) $VERSION, ok?" "N"; then echo "Ok, exiting instead." exit 0 fi echo -echo "Ok, here's the commit message of changes since the last version..." +echo "Ok, here are the commit message of changes since the last version..." LAST_TAG=$(git tag | tail -1) git log $LAST_TAG..HEAD pause @@ -58,18 +63,34 @@ echo echo "Ok, running scottutilz tests including test_some_dependencies.py..." cd ../scottutilz/tests ./run_tests.py --all --coverage -cd ../../pyutilz +cd ../../pyutils pause echo echo +echo "Creating a git tag for version ${VERSION}" git tag -a "${VERSION}" -m "cut_version.sh ${VERSION}" CHANGES=$(git log --pretty="- %s" $VERSION...$LAST_TAG) printf "# 🎁 Release notes (\`$VERSION\`)\n\n## Changes\n$CHANGES\n\n## Metadata\n\`\`\`\nThis version -------- $VERSION\nPrevious version ---- $PREVIOUS_VERSION\nTotal commits ------- $(echo "$CHANGES" | wc -l)\n\`\`\`\n" >> release_notes.md +echo "Updating pyproject.toml with this version number" cat ./pyproject.template | sed s/##VERSION##/$VERSION/g > ./pyproject.toml git commit -a -m "Cut version ${VERSION}" -m "${CHANGES}" -git push +echo "Building..." python -m build -echo "To upload, run: \"twine upload --verbose --repository testpypi dist/*\"" + +WHEEL=dist/pyutils-latest-py3-none-any.whl +if [ ! -f ${WHEEL} ]; then + echo "Can't find ${WHEEL}?!" + exit 1 +fi +LINK=dist/pyutils-latest-py3-none-any.whl +git rm ${LINK} +ln -s ${WHEEL} dist/pyutils-latest-py3-none-any.whl +git add ${WHEEL} +git add ${LINK} +git commit -a -m "Add binary wheel for ${VERSION}" +git push + +echo "Done. To upload, run: \"twine upload --verbose --repository testpypi dist/*\""