1+ name : Deploy Documentation to GitHub Pages
2+
3+ on :
4+ push :
5+ branches : [main, master]
6+ pull_request :
7+ branches : [main, master]
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
12+ pages : write
13+ id-token : write
14+
15+ concurrency :
16+ group : " pages"
17+ cancel-in-progress : false
18+
19+ jobs :
20+ build :
21+ name : Build Documentation
22+ runs-on : ubuntu-latest
23+ steps :
24+ - name : Checkout
25+ uses : actions/checkout@v4
26+
27+ - name : 🦀 Set up Rust
28+ uses : actions-rs/toolchain@v1
29+ with :
30+ toolchain : stable
31+ override : true
32+
33+ - name : Install dependencies
34+ run : sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
35+
36+ - name : Cache Cargo
37+ uses : actions/cache@v4
38+ with :
39+ path : |
40+ ~/.cargo/registry
41+ ~/.cargo/git
42+ target
43+ key : ${{ runner.os }}-cargo-pages-${{ hashFiles('**/Cargo.lock') }}
44+
45+ - name : 📦 Build project
46+ run : cargo build --release
47+
48+ - name : 📚 Generate documentation
49+ run : |
50+ # Set environment variables to prevent browser opening
51+ export GIT_EDITOR_NO_BROWSER=1
52+ export NO_BROWSER=1
53+
54+ # Create docs directory
55+ mkdir -p docs-site
56+
57+ # Generate the documentation HTML
58+ cargo run --release -- --docs
59+
60+ # Copy the generated HTML to docs-site directory
61+ cp /tmp/git-editor-docs.html docs-site/index.html
62+
63+ # Create a simple robots.txt for better SEO
64+ echo -e "User-agent: *\nAllow: /" > docs-site/robots.txt
65+
66+ # Create a .nojekyll file to bypass Jekyll processing
67+ touch docs-site/.nojekyll
68+
69+ - name : Setup Pages
70+ uses : actions/configure-pages@v4
71+
72+ - name : Upload artifact
73+ uses : actions/upload-pages-artifact@v3
74+ with :
75+ path : ' ./docs-site'
76+
77+ deploy :
78+ name : Deploy to GitHub Pages
79+ environment :
80+ name : github-pages
81+ url : ${{ steps.deployment.outputs.page_url }}
82+ runs-on : ubuntu-latest
83+ needs : build
84+ # Only deploy on pushes to main/master, not on PRs
85+ if : github.event_name == 'push' || github.event_name == 'workflow_dispatch'
86+ steps :
87+ - name : Deploy to GitHub Pages
88+ id : deployment
89+ uses : actions/deploy-pages@v4
0 commit comments