forked from SpectrAI-Initiative/InnoClaw
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (85 loc) · 3.09 KB
/
Copy pathdocs.yml
File metadata and controls
100 lines (85 loc) · 3.09 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Documentation
on:
push:
branches: [main]
paths:
- "docs/**"
- "site/**"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "docs/**"
- "site/**"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: docs/requirements.txt
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Build English docs
run: sphinx-build -b html docs docs/_build/html/en -W --keep-going
- name: Build Chinese docs
run: sphinx-build -b html docs docs/_build/html/zh -D language=zh_CN -W --keep-going
- name: Copy homepage into build output
run: |
cp site/index.html docs/_build/html/index.html
cp -r site/logos docs/_build/html/logos
touch docs/_build/html/.nojekyll
- name: Ensure root index does not auto-redirect to zh
run: |
if grep -q 'http-equiv="refresh" content="0; url=zh/"' docs/_build/html/index.html; then
echo "Root index still redirects to zh. Replacing with site homepage."
cp site/index.html docs/_build/html/index.html
fi
- name: Validate root index for GitHub Pages
run: |
if grep -q 'http-equiv="refresh" content="0; url=zh/"' docs/_build/html/index.html; then
echo "::error::Root index.html is still redirecting to /zh/."
echo "::error::Please ensure site/index.html is copied to docs/_build/html/index.html."
exit 1
fi
- name: Upload artifact
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v4
with:
path: docs/_build/html
- name: Link check
continue-on-error: true
run: sphinx-build -b linkcheck docs docs/_build/linkcheck --keep-going
deploy:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
continue-on-error: true
- name: Check deployment result
if: steps.deployment.outcome == 'failure'
run: |
echo "::error::GitHub Pages deployment failed. Please ensure GitHub Pages is enabled in your repository settings:"
echo "::error:: 1. Go to https://github.com/${{ github.repository }}/settings/pages"
echo "::error:: 2. Under 'Build and deployment', set Source to 'GitHub Actions'"
echo "::error:: 3. For private repos, a GitHub Pro/Team/Enterprise plan is required."
exit 1