-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (45 loc) · 1.65 KB
/
deploy.yml
File metadata and controls
54 lines (45 loc) · 1.65 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
name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test GitHub API connectivity
id: test-api
run: |
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/orgs/${{ github.repository_owner }}/repos")
if [ "$RESPONSE" -ne 200 ]; then
echo "::error::Failed to fetch repositories (HTTP $RESPONSE)"
exit 1
fi
echo "API connection successful"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install MkDocs, Material and plugins
run: |
pip install -r requirements.txt
- name: Build documentation
run: mkdocs build --site-dir ./out
- name: Verify structure
run: |
ls -R ./out # Debug: Show built files
test -f ./out/index.html || exit 1
# grep -q "Failed to load repository data" ./out/github_repos/index.html && exit 2
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
# Deletes all files in target repo except .git before deploying new files
keep_files: false
publish_dir: ./out
github_token: ${{ secrets.GITHUB_TOKEN }}
# Force orphan to ensure complete cleanup when needed
force_orphan: false # Set to true if you want complete clean slate (use carefully)