working
This commit is contained in:
parent
feefd59b80
commit
1d6f58ab8b
6 changed files with 98 additions and 1 deletions
39
Makefile
Normal file
39
Makefile
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
SHELL := /bin/bash
|
||||
.PHONY: build serve deploy help
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " make build - Build the static site"
|
||||
@echo " make serve - Serve the site locally on port 8000"
|
||||
@echo " make deploy - Deploy the built site to remote server"
|
||||
@echo ""
|
||||
@echo "For deployment, copy deploy.config.example to deploy.config and fill in your details"
|
||||
|
||||
# Build the site
|
||||
build:
|
||||
@echo "Building site..."
|
||||
python3 build.py
|
||||
|
||||
# Serve locally
|
||||
serve: build
|
||||
@echo "Serving site at http://localhost:8000"
|
||||
@echo "Press Ctrl+C to stop"
|
||||
cd dist && python3 -m http.server 8000
|
||||
|
||||
# Deploy to remote server
|
||||
deploy: build
|
||||
@if [ ! -f deploy.config ]; then \
|
||||
echo "Error: deploy.config not found!"; \
|
||||
echo "Copy deploy.config.example to deploy.config and fill in your details."; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Deploying to remote server..."
|
||||
@source deploy.config; \
|
||||
SSH_CMD="ssh"; \
|
||||
if [ -n "$$SSH_PORT" ]; then SSH_CMD="$$SSH_CMD -p $$SSH_PORT"; fi; \
|
||||
if [ -n "$$SSH_KEY" ]; then SSH_CMD="$$SSH_CMD -i $$SSH_KEY"; fi; \
|
||||
rsync -avz --delete -e "$$SSH_CMD" \
|
||||
dist/ $$REMOTE_USER@$$REMOTE_HOST:$$REMOTE_PATH
|
||||
@echo "✓ Deployment complete!"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue