Skip to content

Commit 48d6e58

Browse files
authored
Merge pull request #22 from jacksongrove/docs
add deployment workflows
2 parents dd1e499 + 196e97d commit 48d6e58

File tree

3 files changed

+170
-65
lines changed

3 files changed

+170
-65
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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"

.github/workflows/docs.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Validate Documentation Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/validate-docs.yml'
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- 'docs/**'
15+
- '.github/workflows/validate-docs.yml'
16+
# Allow manual trigger for testing
17+
workflow_dispatch:
18+
19+
jobs:
20+
validate-docs:
21+
runs-on: ubuntu-latest
22+
defaults:
23+
run:
24+
working-directory: docs
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: '3.12'
32+
cache: 'pip'
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install sphinx sphinx_copybutton sphinx_rtd_theme impossibly
38+
39+
- name: Build documentation
40+
run: |
41+
export LC_ALL=C.UTF-8
42+
export LANG=C.UTF-8
43+
python -m sphinx -b html source build/html
44+
45+
- name: Check for build warnings
46+
run: |
47+
export LC_ALL=C.UTF-8
48+
export LANG=C.UTF-8
49+
python -m sphinx -b html source build/html -W
50+
continue-on-error: true
51+
52+
- name: Upload build artifacts
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: documentation-validation
56+
path: docs/build/html
57+
retention-days: 7
58+
# Only upload on main branch to save storage
59+
if: github.ref == 'refs/heads/main'
60+
61+
- name: Validation Summary
62+
run: |
63+
echo "📋 Documentation validation completed!"
64+
echo "✅ Build successful"
65+
echo "📁 Artifacts uploaded for review"
66+
echo ""
67+
echo "NOTE: This is a validation-only workflow."
68+
echo "For production deployment, use the 'Deploy to Production' workflow."

0 commit comments

Comments
 (0)