-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_docs.py
More file actions
46 lines (36 loc) · 1.33 KB
/
deploy_docs.py
File metadata and controls
46 lines (36 loc) · 1.33 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
#!/usr/bin/env python3
"""
MkDocs Deployment Script
Build and deploy MkDocs documentation to GitHub Pages
"""
import subprocess
import sys
import os
from pathlib import Path
def main():
"""Deploy MkDocs documentation to GitHub Pages"""
print("🚀 Deploying MkDocs documentation to GitHub Pages...")
# Change to api directory where mkdocs.yml is located
api_dir = Path(__file__).parent / "api"
if not api_dir.exists():
print("❌ API directory not found!")
sys.exit(1)
os.chdir(api_dir)
# Check if mkdocs.yml exists
if not Path("mkdocs.yml").exists():
print("❌ mkdocs.yml not found in api directory!")
sys.exit(1)
try:
# Build the documentation
print("🔨 Building documentation...")
subprocess.run([sys.executable, "-m", "mkdocs", "build", "--clean"], check=True)
# Deploy to GitHub Pages
print("📤 Deploying to GitHub Pages...")
subprocess.run([sys.executable, "-m", "mkdocs", "gh-deploy"], check=True)
print("✅ Documentation deployed successfully!")
print("📖 Your documentation will be available at: https://OMCHOKSI108.github.io/text-classifier-api/")
except subprocess.CalledProcessError as e:
print(f"❌ Deployment failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()