Add comprehensive help documentation to versionbump.sh
This commit is contained in:
parent
e92e4f1df8
commit
3235ffd66e
|
@ -1,16 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# versionbump.sh - Script to bump version numbers in the VERSION file and update all relevant files
|
||||
# Usage: ./versionbump.sh [major|minor|patch|set VERSION]
|
||||
# Usage: ./versionbump.sh [major|minor|patch|set VERSION|--help|-h]
|
||||
|
||||
set -e
|
||||
|
||||
VERSION_FILE="VERSION"
|
||||
DOCKER_COMPOSE_FILE="docker-compose.yml"
|
||||
|
||||
# Function to display help information
|
||||
show_help() {
|
||||
cat << EOF
|
||||
Ploughshares Version Management Tool
|
||||
===================================
|
||||
|
||||
USAGE:
|
||||
./versionbump.sh [COMMAND]
|
||||
|
||||
COMMANDS:
|
||||
major Bump the major version (X.y.z -> X+1.0.0)
|
||||
minor Bump the minor version (x.Y.z -> x.Y+1.0)
|
||||
patch Bump the patch version (x.y.Z -> x.y.Z+1)
|
||||
set VERSION Set the version to a specific value (e.g., set 1.2.3)
|
||||
--help, -h Display this help message
|
||||
|
||||
DESCRIPTION:
|
||||
This script manages the version number for the Ploughshares application.
|
||||
It updates the version in multiple locations:
|
||||
|
||||
1. The VERSION file (source of truth)
|
||||
2. Console log messages in app.py
|
||||
3. Docker Compose environment variables
|
||||
|
||||
After running this script, you need to rebuild and restart the application
|
||||
for the changes to take effect.
|
||||
|
||||
EXAMPLES:
|
||||
./versionbump.sh major # 1.2.3 -> 2.0.0
|
||||
./versionbump.sh minor # 1.2.3 -> 1.3.0
|
||||
./versionbump.sh patch # 1.2.3 -> 1.2.4
|
||||
./versionbump.sh set 1.5.0 # Set to specific version 1.5.0
|
||||
|
||||
VERSION HISTORY:
|
||||
The script maintains a log of version changes in version_history.log
|
||||
EOF
|
||||
}
|
||||
|
||||
# Check if help is requested or no arguments provided
|
||||
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ -z "$1" ]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if VERSION file exists
|
||||
if [ ! -f "$VERSION_FILE" ]; then
|
||||
echo "Error: $VERSION_FILE does not exist."
|
||||
echo "Run with --help for usage information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -48,6 +93,7 @@ update_version_everywhere() {
|
|||
if [ "$1" = "set" ]; then
|
||||
if [ -z "$2" ]; then
|
||||
echo "Error: No version specified. Usage: $0 set VERSION"
|
||||
echo "Run with --help for usage information."
|
||||
exit 1
|
||||
fi
|
||||
NEW_VERSION="$2"
|
||||
|
@ -74,10 +120,8 @@ case "$1" in
|
|||
PATCH=$((PATCH + 1))
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [major|minor|patch|set VERSION]"
|
||||
echo "Examples:"
|
||||
echo " $0 minor # Bump minor version"
|
||||
echo " $0 set 1.2.3 # Set specific version"
|
||||
echo "Error: Unknown command '$1'"
|
||||
echo "Run with --help for usage information."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue