-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (75 loc) · 2.42 KB
/
Copy pathdocs.yml
File metadata and controls
86 lines (75 loc) · 2.42 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
name: Deploy Documentation
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to run action on"
required: false
default: "main"
permissions:
contents: write
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install MkDocs and plugins
run: |
python -m pip install --upgrade pip
pip install mkdocs \
mkdocs-material \
mkdocstrings \
mkdocstrings-python \
pymdown-extensions \
pygments \
mkdocs-git-revision-date-localized-plugin
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Build documentation
run: mkdocs build --strict
env:
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
- name: Check for broken links
run: |
if [ -f ./site/404.html ]; then
echo "🔍 Checking for broken links..."
if grep -r "404.html" ./site/; then
echo "❌ Broken links found."
exit 1
fi
fi
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'docs: update documentation'
- name: Check deployment status
run: |
SITE_URL="https://holobiomicslab.github.io/MetaboT/"
for i in {1..10}; do
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 $SITE_URL)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "✅ Documentation deployed successfully at $SITE_URL"
exit 0
fi
echo "⌛ Waiting for GitHub Pages... ($i)"
sleep 15
done
echo "❌ Deployment check failed after waiting."
exit 1