niceify build script
This commit is contained in:
parent
df0a145f3b
commit
f21d20e08c
2 changed files with 33 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
|||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview",
|
||||
"build:deploy": "bash scripts/bump-build-push.sh",
|
||||
"build:deploy": "bash scripts/publish.sh",
|
||||
"generate:schema": "node scripts/generate-schema.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -2,12 +2,41 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
# Function to display help text
|
||||
show_help() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo
|
||||
echo "Description:"
|
||||
echo " This script automates the process of bumping the version, building a Docker image,"
|
||||
echo " pushing it to the registry, and optionally deploying to production."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -h, --help Display this help message and exit"
|
||||
echo " -d, --deploy Deploy to production after building and pushing"
|
||||
echo " --major Bump the major version (x.0.0)"
|
||||
echo " --minor Bump the minor version (0.x.0)"
|
||||
echo " --patch Bump the patch version (0.0.x) [default]"
|
||||
echo
|
||||
echo "Examples:"
|
||||
echo " $0 # Bump patch version, build and push"
|
||||
echo " $0 --minor # Bump minor version, build and push"
|
||||
echo " $0 --major -d # Bump major version, build, push and deploy"
|
||||
echo " $0 --patch --deploy # Bump patch version, build, push and deploy"
|
||||
echo
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
DEPLOY=false
|
||||
VERSION_TYPE="patch" # Default to patch version bump
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
-h|--help) show_help; exit 0 ;;
|
||||
-d|--deploy) DEPLOY=true ;;
|
||||
*) echo "Unknown option: $arg"; echo "Usage: $0 [-d|--deploy]"; exit 1 ;;
|
||||
--major) VERSION_TYPE="major" ;;
|
||||
--minor) VERSION_TYPE="minor" ;;
|
||||
--patch) VERSION_TYPE="patch" ;;
|
||||
*) echo "Unknown option: $arg"; echo "Usage: $0 [-h|--help] [-d|--deploy] [--major|--minor|--patch]"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -30,8 +59,8 @@ OLD_VERSION=$(node -p "require('./package.json').version")
|
|||
echo "🔍 Current version: $OLD_VERSION"
|
||||
|
||||
# Step 2: Bump version without Git tag/commit
|
||||
echo "🚀 Bumping minor version..."
|
||||
yarn version --minor --no-git-tag-version
|
||||
echo "🚀 Bumping $VERSION_TYPE version..."
|
||||
yarn version --$VERSION_TYPE --no-git-tag-version
|
||||
NEW_VERSION=$(node -p "require('./package.json').version")
|
||||
echo "📦 New version: $NEW_VERSION"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue