-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_deploy.py
More file actions
62 lines (51 loc) · 1.57 KB
/
test_deploy.py
File metadata and controls
62 lines (51 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
"""
Quick test script to test deployment from inside the container.
"""
import sys
from pathlib import Path
# Add project root to path so we can import from src
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
from src.hugo.generator import HugoGenerator
from src.config import DEPLOY_ENABLED, DEPLOY_DESTINATION, DEPLOY_HOST_IP
def main():
print("=" * 60)
print("🧪 Testing Deployment")
print("=" * 60)
print()
if not DEPLOY_ENABLED:
print("❌ Deployment is disabled (DEPLOY_ENABLED=false)")
print(" Set DEPLOY_ENABLED=true in .env")
return 1
print(f"📋 Configuration:")
print(f" Destination: {DEPLOY_DESTINATION}")
if DEPLOY_HOST_IP:
print(f" Using IP: {DEPLOY_HOST_IP}")
else:
print(f" ⚠️ No DEPLOY_HOST_IP set - will use hostname from DEPLOY_DESTINATION")
print()
# Build first
print("🔨 Building Hugo site...")
generator = HugoGenerator()
build_success = generator.build_site()
if not build_success:
print("❌ Build failed, skipping deployment")
return 1
print()
print("🚀 Deploying site...")
deploy_success = generator.deploy_site()
if deploy_success:
print()
print("=" * 60)
print("✅ Deployment test successful!")
print("=" * 60)
return 0
else:
print()
print("=" * 60)
print("❌ Deployment test failed")
print("=" * 60)
return 1
if __name__ == "__main__":
sys.exit(main())