Skip to content

Commit 3aba466

Browse files
authored
Add GitHub Actions workflow for documentation build
1 parent 487b7b9 commit 3aba466

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/build-docs.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Deploy Documentation
2+
3+
on:
4+
schedule:
5+
# Run weekly on Sundays at midnight UTC
6+
- cron: "0 0 * * 0"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Resolve repository and book title
26+
id: resolve
27+
run: |
28+
set -eo pipefail
29+
30+
REPO_INPUT="${{ github.event.inputs.repo }}"
31+
if [ -n "$REPO_INPUT" ]; then
32+
REPO_VALUE="$REPO_INPUT"
33+
else
34+
REPO_VALUE="${{ github.repository }}"
35+
fi
36+
37+
TITLE_INPUT="${{ github.event.inputs.book_title }}"
38+
if [ -n "$TITLE_INPUT" ]; then
39+
TITLE_VALUE="$TITLE_INPUT"
40+
else
41+
REPO_NAME="${REPO_VALUE#*/}"
42+
if [ -z "$REPO_NAME" ]; then
43+
TITLE_VALUE="Documentation"
44+
else
45+
TITLE_VALUE="$REPO_NAME Documentation"
46+
fi
47+
fi
48+
49+
echo "repo_value=$REPO_VALUE" >> "$GITHUB_OUTPUT"
50+
echo "title_value=$TITLE_VALUE" >> "$GITHUB_OUTPUT"
51+
echo "Using repository: $REPO_VALUE"
52+
echo "Using book title: $TITLE_VALUE"
53+
54+
- name: Prepare output directory
55+
run: |
56+
rm -rf output
57+
mkdir -p output
58+
59+
- name: Generate DeepWiki docs
60+
uses: jzombie/deepwiki-to-mdbook@main
61+
with:
62+
repo: ${{ steps.resolve.outputs.repo_value }}
63+
book_title: ${{ steps.resolve.outputs.title_value }}
64+
output_dir: ./output
65+
66+
- name: Upload artifact for Pages
67+
uses: actions/upload-pages-artifact@v3
68+
with:
69+
path: ./output/book
70+
71+
deploy:
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
runs-on: ubuntu-latest
76+
needs: build
77+
steps:
78+
- name: Deploy to GitHub Pages
79+
id: deployment
80+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)