Skip to content

Instantly share code, notes, and snippets.

@archatas
Last active February 14, 2024 10:50
Show Gist options
  • Save archatas/2c46648af38b62e88cdc6ded94f41bca to your computer and use it in GitHub Desktop.
Save archatas/2c46648af38b62e88cdc6ded94f41bca to your computer and use it in GitHub Desktop.
Interactive build bash script for releasing Python packages
#!/bin/bash
echo "Did you update the CHANGELOG.md and commit the changes? (y/N)"
read answer
if [[ $answer != "y" && $answer != "Y" ]]; then
echo "Please update and commit the changelog before building."
exit 1
fi
echo "Choose version bump type (major, minor, patch):"
read bump_type
if [[ ! ( $bump_type == "major" || $bump_type == "minor" || $bump_type == "patch" ) ]]; then
echo "Invalid bump type. Please choose major, minor, or patch."
exit 1
fi
echo "Bumping version to $bump_type..."
bump2version $bump_type
echo "Building source distribution and wheel..."
python3 setup.py sdist bdist_wheel
echo "Build complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment