11#! /bin/bash
22
3- # A robust script to automate the release process using bump-my-version .
4- # It ensures checks pass before releasing.
3+ # A robust script to automate the release process using semantic versioning .
4+ # Usage: ./release.sh patch|minor|major
55
66# Exit immediately if a command exits with a non-zero status.
77set -e
88
9- # --- 1. Get the new version number ---
10- VERSION =$1
9+ # --- 1. Get the type of version bump ---
10+ BUMP_TYPE =$1
1111
12- if [ -z " $VERSION " ]; then
13- echo " Error: No version specified."
14- echo " Usage: ./release.sh <new_version>"
15- echo " Example: ./release.sh 0.2.0"
12+ if [[ " $BUMP_TYPE " != " patch" && " $BUMP_TYPE " != " minor" && " $BUMP_TYPE " != " major" ]]; then
13+ echo " Error: Invalid or no bump type specified."
14+ echo " Usage: ./release.sh <patch|minor|major>"
1615 exit 1
1716fi
1817
19- echo " 🚀 Preparing new release: v $VERSION "
18+ echo " 🚀 Preparing a ' $BUMP_TYPE ' release... "
2019
2120# --- 2. Run Linters & Tests ---
2221echo " 🛡️ Running checks and tests..."
@@ -26,12 +25,14 @@ pytest
2625echo " ✅ All checks passed!"
2726
2827# --- 3. Bump Version, Commit, and Tag ---
28+ # The tool will now automatically figure out the current version,
29+ # increment it, update the files, commit, and tag.
2930echo " 🔖 Bumping version, committing, and tagging..."
30- bump-my-version bump --new-version " $VERSION "
31+ bump-my-version bump " $BUMP_TYPE "
3132
3233# --- 4. Push to trigger release workflow ---
3334echo " 📤 Pushing commit and tag to GitHub..."
3435git push && git push --tags
3536
36- echo " 🎉 Successfully published version v $VERSION !"
37- echo " Check the GitHub Actions tab for the publish workflow ."
37+ echo " 🎉 Successfully triggered release workflow !"
38+ echo " Check the GitHub Actions tab for the publish progress ."
0 commit comments