Replaces awkward deployment workflow with streamlined process: ✅ Before: 1. Deploy script detects JS changes 2. Runs update-cache-version.js 3. Creates uncommitted changes 4. Prompts user to cancel/commit/re-run 5. Manual loop required ✅ After: 1. Deploy script detects JS changes 2. Runs update-cache-version.js 3. Auto-commits cache changes 4. Continues to deployment 5. Done Features: - Unified script (scripts/deploy.sh) replaces two separate scripts - Auto-commit cache version changes (no manual loops) - Flags: --frontend-only, --force-cache, --restart, --dry-run - Security: preserves .rsyncignore exclusions - Validation: checks local server, git status, dry-run preview Migration: - OLD: ./scripts/deploy-full-project-SAFE.sh NEW: ./scripts/deploy.sh - OLD: ./scripts/deploy-frontend.sh NEW: ./scripts/deploy.sh --frontend-only Changes: - Added: scripts/deploy.sh (unified deployment script) - Modified: scripts/deploy-frontend.sh (deprecated with migration notice) - Updated: CLAUDE.md (new deployment workflow documentation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
2.1 KiB
Bash
Executable file
71 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
##
|
|
## ⚠️ DEPRECATED - Use scripts/deploy.sh instead
|
|
##
|
|
## This script is deprecated in favor of the unified deployment script.
|
|
## The new script provides:
|
|
## - Automatic cache versioning (update-cache-version.js)
|
|
## - Auto-commit of cache changes (no more manual loops)
|
|
## - Frontend-only mode (--frontend-only flag)
|
|
## - Better security and validation
|
|
##
|
|
## Migration:
|
|
## OLD: ./scripts/deploy-frontend.sh
|
|
## NEW: ./scripts/deploy.sh --frontend-only
|
|
##
|
|
## See: scripts/deploy.sh for full documentation
|
|
##
|
|
|
|
echo "⚠️ WARNING: This script is deprecated"
|
|
echo "Please use: ./scripts/deploy.sh --frontend-only"
|
|
echo ""
|
|
read -p "Continue with deprecated script anyway? (yes/NO): " continue_deprecated
|
|
if [ "$continue_deprecated" != "yes" ]; then
|
|
echo "Cancelled. Use ./scripts/deploy.sh --frontend-only instead."
|
|
exit 1
|
|
fi
|
|
|
|
# Deploy Frontend with Automatic Cache Busting
|
|
# Ensures users always get latest JS/CSS without manual cache clearing
|
|
|
|
set -e
|
|
|
|
TIMESTAMP=$(date +%s)
|
|
DEPLOY_KEY="/home/theflow/.ssh/tractatus_deploy"
|
|
REMOTE_USER="ubuntu"
|
|
REMOTE_HOST="vps-93a693da.vps.ovh.net"
|
|
REMOTE_PATH="/var/www/tractatus/public"
|
|
|
|
echo "=== Frontend Deployment with Cache Busting ==="
|
|
echo ""
|
|
echo "Timestamp: $TIMESTAMP"
|
|
echo ""
|
|
|
|
# Update cache-busting version in all HTML files
|
|
echo "Updating cache-busting versions..."
|
|
find public -name "*.html" -type f | while read -r file; do
|
|
# Update script tags - match .js followed by anything (including ?v=digits) before closing quote
|
|
sed -i "s|\(src=\"[^\"]*\.js\)[^\"]*\"|\1?v=${TIMESTAMP}\"|g" "$file"
|
|
# Update link tags (CSS) - same pattern
|
|
sed -i "s|\(href=\"[^\"]*\.css\)[^\"]*\"|\1?v=${TIMESTAMP}\"|g" "$file"
|
|
echo " ✓ Updated: $file"
|
|
done
|
|
|
|
echo ""
|
|
echo "Deploying to production..."
|
|
|
|
# Deploy all public files
|
|
rsync -avz --delete \
|
|
-e "ssh -i $DEPLOY_KEY" \
|
|
--exclude='node_modules' \
|
|
--exclude='.git' \
|
|
public/ ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_PATH}/
|
|
|
|
echo ""
|
|
echo "=== Deployment Complete ==="
|
|
echo ""
|
|
echo "All users will receive new version: $TIMESTAMP"
|
|
echo "No cache clearing required!"
|
|
echo ""
|
|
echo "Test URL: https://agenticgovernance.digital"
|