add deployment script
This commit is contained in:
parent
2327eed7e2
commit
f1a4dbe24b
2 changed files with 53 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "femto-webapp",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite --host 0.0.0.0",
|
||||
|
|
52
scripts/bump-build-push.sh
Executable file
52
scripts/bump-build-push.sh
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# CONFIGURATION
|
||||
REGISTRY="docker.botris.dev"
|
||||
USERNAME="johnbotris"
|
||||
IMAGE_NAME="femto-webapp"
|
||||
|
||||
# Step 0: Ensure clean working directory
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
echo "❌ Uncommitted changes detected. Please commit or stash them before running this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 1: Store current version to revert if needed
|
||||
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
|
||||
NEW_VERSION=$(node -p "require('./package.json').version")
|
||||
echo "📦 New version: $NEW_VERSION"
|
||||
|
||||
# Step 3: Attempt Docker build
|
||||
echo "🔧 Building Docker image..."
|
||||
if ! docker build -t $IMAGE_NAME .; then
|
||||
echo "❌ Docker build failed. Reverting version bump..."
|
||||
git checkout -- package.json yarn.lock
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 4: Tag and push Docker image
|
||||
FULL_IMAGE="$REGISTRY/$USERNAME/$IMAGE_NAME"
|
||||
echo "🏷️ Tagging Docker image..."
|
||||
docker tag $IMAGE_NAME $FULL_IMAGE:$NEW_VERSION
|
||||
docker tag $IMAGE_NAME $FULL_IMAGE:latest
|
||||
|
||||
echo "📤 Pushing Docker images..."
|
||||
docker push $FULL_IMAGE:$NEW_VERSION
|
||||
docker push $FULL_IMAGE:latest
|
||||
|
||||
# Step 5: Commit version bump & tag
|
||||
echo "✅ Committing and tagging version bump..."
|
||||
git add package.json yarn.lock
|
||||
git commit -m "chore(release): v$NEW_VERSION"
|
||||
git tag "v$NEW_VERSION"
|
||||
git push origin main
|
||||
git push origin "v$NEW_VERSION"
|
||||
|
||||
echo "🎉 Release v$NEW_VERSION complete."
|
Loading…
Add table
Add a link
Reference in a new issue