43 lines
844 B
Bash
Executable File
43 lines
844 B
Bash
Executable File
#!/bin/bash
|
|
# Deploy script - increments version, commits, pushes, and relaunches container
|
|
# Usage: ./scripts/deploy.sh [optional commit message]
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Extract current version number from templates.go
|
|
CURRENT=$(grep -o '>v[0-9]*<' templates.go | grep -o '[0-9]*' | head -1)
|
|
|
|
if [ -z "$CURRENT" ]; then
|
|
echo "Could not find version number in templates.go"
|
|
exit 1
|
|
fi
|
|
|
|
# Increment version
|
|
NEW=$((CURRENT + 1))
|
|
|
|
# Update templates.go
|
|
sed -i '' "s/>v${CURRENT}</>v${NEW}</" templates.go
|
|
|
|
echo "Version: v${CURRENT} -> v${NEW}"
|
|
|
|
# Build commit message
|
|
if [ -n "$1" ]; then
|
|
COMMIT_MSG="v${NEW}: $1"
|
|
else
|
|
COMMIT_MSG="v${NEW}"
|
|
fi
|
|
|
|
# Commit and push
|
|
git add -A
|
|
git commit -m "$COMMIT_MSG"
|
|
git push
|
|
|
|
echo "Committed: $COMMIT_MSG"
|
|
|
|
# Rebuild and relaunch
|
|
docker compose up -d --build
|
|
|
|
echo "Deployed v${NEW}"
|