-
Notifications
You must be signed in to change notification settings - Fork 10
131 lines (112 loc) · 3.87 KB
/
Copy pathdocs-2.5.yml
File metadata and controls
131 lines (112 loc) · 3.87 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
121
122
123
124
125
126
127
128
129
130
131
name: Basalt 2.5 Docs & Deploy
on:
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Generate and build versioned docs
runs-on: ubuntu-22.04
steps:
- name: Checkout deployment automation
uses: actions/checkout@v6
with:
ref: main
path: automation
- name: Checkout Basalt 2.5
uses: actions/checkout@v6
with:
ref: basalt2.5
path: source
- name: Checkout documentation branch
uses: actions/checkout@v6
with:
ref: gh-pages
path: site
- name: Install CraftOS-PC
run: |
sudo add-apt-repository --yes ppa:jackmacwindows/ppa
sudo apt-get update
sudo apt-get install --yes craftos-pc
- name: Generate Basalt 2.5 API documentation
run: |
mkdir -p "$RUNNER_TEMP/craftos-docs"
mkdir -p "$RUNNER_TEMP/basalt-docs"
craftos \
--headless \
--directory "$RUNNER_TEMP/craftos-docs" \
--mount-ro "Basalt=$GITHUB_WORKSPACE/source" \
--mount-rw "output=$RUNNER_TEMP/basalt-docs" \
--exec "local ok=shell.run('Basalt/tools/docgen.lua','output'); os.shutdown(ok and 0 or 1)"
- name: Update Basalt 2.5 documentation source
run: |
mkdir -p site/docs/2.5/api
mkdir -p site/docs/2.5/.vitepress
# Docgen only owns generated API pages; keep the hand-written index.
rsync --archive --delete --exclude index.md \
"$RUNNER_TEMP/basalt-docs/" \
site/docs/2.5/api/
cp source/.github/docs-2.5-index.md site/docs/2.5/index.md
cp source/.github/docs-2.5-home.md site/docs/2.5/home.md
cp source/.github/vitepress-2.5.config.mts \
site/docs/2.5/.vitepress/config.mts
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 20
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install VitePress dependencies
working-directory: site
run: npm ci
- name: Build Basalt 2.0 and 2.5 sites
working-directory: site
run: |
mkdir -p "$RUNNER_TEMP/pages/2.0"
mkdir -p "$RUNNER_TEMP/pages/2.5"
mv docs/.vitepress/config.mts \
docs/.vitepress/config.base.mts
cp ../automation/.github/vitepress-2.0.config.mts \
docs/.vitepress/config.mts
npx vitepress build docs \
--outDir "$RUNNER_TEMP/pages/2.0"
npx vitepress build docs/2.5 \
--outDir "$RUNNER_TEMP/pages/2.5"
cp ../automation/.github/pages-index.html \
"$RUNNER_TEMP/pages/index.html"
touch "$RUNNER_TEMP/pages/.nojekyll"
node ../automation/.github/scripts/create-version-redirects.mjs \
"$RUNNER_TEMP/pages/2.0" \
"$RUNNER_TEMP/pages"
- name: Commit Basalt 2.5 documentation source
working-directory: site
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/2.5
if git diff --cached --quiet; then
echo "Basalt 2.5 documentation is already current."
else
git commit -m "docs: update Basalt 2.5 API"
git push
fi
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ runner.temp }}/pages
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v4