-
Notifications
You must be signed in to change notification settings - Fork 37
99 lines (82 loc) · 2.61 KB
/
Copy pathdeploy.yml
File metadata and controls
99 lines (82 loc) · 2.61 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
name: Deploy MkDocs to GitHub Pages
on:
push:
branches: [main, en, mkdocs-migration]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install mkdocs-material mkdocs-static-i18n
- run: mkdocs build
- uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
test:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Wait for site availability
run: |
BASE_URL="${{ needs.deploy.outputs.page_url }}"
for i in $(seq 1 30); do
curl -sf -o /dev/null "$BASE_URL" && break
sleep 2
done
- name: Check all page URLs
run: |
BASE_URL="${{ needs.deploy.outputs.page_url }}"
BASE_URL="${BASE_URL%/}"
URLS_FILE=$(mktemp)
# English pages (exclude es/hu subdirs)
find docs -name '*.md' -not -path 'docs/es/*' -not -path 'docs/hu/*' | sort | while IFS= read -r f; do
rel="${f#docs/}"; rel="${rel%.md}"
if [ "$rel" = "index" ]; then echo "$BASE_URL/"; else echo "$BASE_URL/$rel/"; fi
done >> "$URLS_FILE"
# ES and HU pages
for lang in es hu; do
[ -d "docs/$lang" ] || continue
find "docs/$lang" -name '*.md' | sort | while IFS= read -r f; do
rel="${f#docs/$lang/}"; rel="${rel%.md}"
if [ "$rel" = "index" ]; then echo "$BASE_URL/$lang/"; else echo "$BASE_URL/$lang/$rel/"; fi
done >> "$URLS_FILE"
done
TOTAL=$(wc -l < "$URLS_FILE")
echo "Checking $TOTAL URLs..."
FAILED=0
while IFS= read -r url; do
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" "$url" || true)
if [ "$STATUS" != "200" ]; then
echo "FAIL [$STATUS]: $url"
FAILED=$((FAILED + 1))
else
echo " OK: $url"
fi
done < "$URLS_FILE"
rm -f "$URLS_FILE"
echo ""
echo "Checked: $TOTAL | Failed: $FAILED"
[ "$FAILED" -eq 0 ]