-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (102 loc) · 3.29 KB
/
deploy.yml
File metadata and controls
120 lines (102 loc) · 3.29 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Deploy to GitHub Pages
on:
push:
branches: [main]
repository_dispatch:
types: [docs-updated]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout website repo
uses: actions/checkout@v4
# --- Pull docs from plugin repos ---
- name: Checkout MyTrip docs
uses: actions/checkout@v4
with:
repository: ChafficPlugins/MyTrip
path: _repos/mytrip
sparse-checkout: docs
- name: Checkout MiningLevels docs
uses: actions/checkout@v4
with:
repository: ChafficPlugins/MiningLevels
path: _repos/mininglevels
sparse-checkout: docs
- name: Checkout CrucialLib docs
uses: actions/checkout@v4
with:
repository: ChafficPlugins/CrucialLib
path: _repos/cruciallib
sparse-checkout: docs
- name: Aggregate docs from all repos
run: |
for repo in mytrip mininglevels cruciallib; do
if [ -d "_repos/$repo/docs" ]; then
mkdir -p "docs/$repo"
cp -r "_repos/$repo/docs/." "docs/$repo/"
echo "Copied docs from $repo"
else
echo "No docs/ folder found in $repo (skipping)"
fi
done
# Generate placeholder stubs for any nav entries that don't have
# a real file yet, so MkDocs doesn't warn about missing pages.
grep -oP ':\s+\K\S+\.md' mkdocs.yml | while read -r page; do
if [ ! -f "docs/$page" ]; then
mkdir -p "docs/$(dirname "$page")"
title=$(basename "$page" .md | sed 's/-/ /g; s/\b\(.\)/\u\1/g')
printf '# %s\n\n!!! info "Coming Soon"\n This page is under construction.\n' "$title" > "docs/$page"
echo "Generated placeholder: docs/$page"
fi
done
echo ""
echo "Final docs structure:"
find docs -type f -name "*.md" | sort
# --- Build MkDocs ---
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache pip
uses: actions/cache@v4
with:
key: mkdocs-material-${{ hashFiles('mkdocs.yml') }}
path: ~/.cache
restore-keys: mkdocs-material-
- name: Install MkDocs Material
run: pip install "mkdocs>=1.6,<2" mkdocs-material
- name: Build docs
run: mkdocs build
# --- Combine landing page + docs into one artifact ---
- name: Assemble site
run: |
mkdir _site
# Landing page files
cp index.html _site/
cp redirect.html _site/
cp privacy.html _site/
cp -r style _site/
cp -r img _site/
# MkDocs output → /docs/
mv site _site/docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4