Initial commit
This commit is contained in:
47
deploy.sh
Executable file
47
deploy.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Dispute Protocol Deployment Script
|
||||
# This script builds and deploys the dispute protocol site to a remote server
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
SSH_USER=${1:-$USER}
|
||||
SSH_HOST=${2:-"example.com"}
|
||||
DEPLOY_PATH=${3:-"/var/www/dispute-protocol"}
|
||||
BUILD_DIR="public"
|
||||
|
||||
# Check if Hugo is installed
|
||||
if ! command -v hugo &> /dev/null; then
|
||||
echo -e "${RED}Error: Hugo is not installed. Please install Hugo first.${NC}"
|
||||
echo "Visit https://gohugo.io/installation/ for installation instructions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Building site...${NC}"
|
||||
hugo --minify
|
||||
|
||||
# Check if build succeeded
|
||||
if [ ! -d "$BUILD_DIR" ]; then
|
||||
echo -e "${RED}Error: Build failed. The '$BUILD_DIR' directory doesn't exist.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Deploying to $SSH_USER@$SSH_HOST:$DEPLOY_PATH...${NC}"
|
||||
|
||||
# Create directory if it doesn't exist
|
||||
ssh $SSH_USER@$SSH_HOST "mkdir -p $DEPLOY_PATH"
|
||||
|
||||
# Deploy using rsync
|
||||
rsync -avz --delete $BUILD_DIR/ $SSH_USER@$SSH_HOST:$DEPLOY_PATH
|
||||
|
||||
echo -e "${GREEN}Deployment completed successfully!${NC}"
|
||||
echo -e "${YELLOW}NOTE: Make sure your web server is configured correctly to serve the site.${NC}"
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user