1+ name : Deploy Documentation to Production
2+
3+ on :
4+ # Only manual trigger - no automatic triggers
5+ workflow_dispatch :
6+ inputs :
7+ environment :
8+ description : ' Environment to deploy to'
9+ required : true
10+ default : ' production'
11+ type : choice
12+ options :
13+ - production
14+ - preview
15+
16+ jobs :
17+ check-unauthorized :
18+ runs-on : ubuntu-latest
19+ if : github.actor != 'jacksongrove'
20+ steps :
21+ - name : Unauthorized deployment attempt
22+ run : |
23+ echo "❌ UNAUTHORIZED: Only the repository owner can deploy to production"
24+ echo "👤 User: ${{ github.actor }}"
25+ echo "📋 Branch: ${{ github.ref }}"
26+ echo ""
27+ echo "💡 If you're contributing to this project:"
28+ echo " - Submit a pull request instead"
29+ echo " - Documentation validation happens automatically on PRs"
30+ echo " - Production deployments are restricted to the maintainer"
31+ exit 1
32+
33+ deploy-to-production :
34+ runs-on : ubuntu-latest
35+ environment : production
36+ # Only allow deployment from main branch by repo owner
37+ if : github.ref == 'refs/heads/main' && github.actor == 'jacksongrove'
38+ defaults :
39+ run :
40+ working-directory : docs
41+ steps :
42+ - name : Check authorization
43+ run : |
44+ echo "🔒 Production deployment authorized for: ${{ github.actor }}"
45+ echo "📋 Branch: ${{ github.ref }}"
46+ echo "🎯 Environment: ${{ github.event.inputs.environment }}"
47+ echo "🚀 Deploying to: impossibly.dev/docs"
48+
49+ - uses : actions/checkout@v3
50+
51+ - name : Set up Python
52+ uses : actions/setup-python@v4
53+ with :
54+ python-version : ' 3.12'
55+ cache : ' pip'
56+
57+ - name : Install dependencies
58+ run : |
59+ python -m pip install --upgrade pip
60+ pip install sphinx sphinx_copybutton sphinx_rtd_theme impossibly
61+
62+ - name : Build documentation
63+ run : |
64+ export LC_ALL=C.UTF-8
65+ export LANG=C.UTF-8
66+ python -m sphinx -b html source build/html
67+
68+ - name : Install Vercel CLI
69+ run : npm install --global vercel@latest
70+
71+ - name : Deploy to Vercel
72+ run : |
73+ if [ "${{ github.event.inputs.environment }}" = "production" ]; then
74+ vercel --token=${{ secrets.VERCEL_TOKEN }} --prod --yes
75+ else
76+ vercel --token=${{ secrets.VERCEL_TOKEN }} --yes
77+ fi
78+ env :
79+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
80+ VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
81+
82+ - name : Production Deployment Summary
83+ run : |
84+ echo "🚀 PRODUCTION Deployment completed successfully!"
85+ echo ""
86+ echo "📊 Deployment Details:"
87+ echo " • Environment: ${{ github.event.inputs.environment }}"
88+ echo " • Branch: ${{ github.ref }}"
89+ echo " • Deployed by: ${{ github.actor }}"
90+ echo " • Timestamp: $(date)"
91+ echo ""
92+ echo "🌍 Live URLs:"
93+ echo " • Production: https://impossibly.dev/docs"
94+ echo " • Direct Vercel: Check Vercel dashboard"
95+ echo ""
96+ echo "📋 Workflow Summary:"
97+ echo " • VALIDATION: Runs on all PRs and merges (free)"
98+ echo " • PRODUCTION: Manual deployment only (this workflow)"
99+ echo ""
100+ echo "⚙️ Next Steps:"
101+ echo " • Verify deployment at https://impossibly.dev/docs"
102+ echo " • Update main site routing if needed"
0 commit comments