Skip to content

Commit 83930ea

Browse files
Merge pull request #14 from clash-lang/lara/root-book
add root book as a landing page
2 parents 53b505c + a9ce42f commit 83930ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+40
-3199
lines changed

.github/workflows/build-docs.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@ jobs:
4343
id: pages
4444
uses: actions/configure-pages@v5
4545

46+
- name: Build root book with mdBook
47+
run: mdbook build
48+
49+
- name: Add root files
50+
run: |
51+
cp CNAME public/
52+
cp robots.txt public/
53+
4654
- name: Copy PR previews
4755
# If there are no open PR's, this step will emit error messages that no
4856
# files matched and it does not look like a tar archive. These are
4957
# expected and don't indicate a problem.
5058
run: |
51-
mkdir -p public
5259
git fetch --depth=1 origin +gh-pages:refs/remotes/origin/gh-pages
53-
git archive --prefix=public/ refs/remotes/origin/gh-pages -- ':(glob)pr-*/**' | tar x || true
54-
55-
- name: Add root files
56-
run: |
57-
cp CNAME public/
58-
cp index.html public/
60+
git archive --prefix=public/ refs/remotes/origin/gh-pages -- ':(glob)pr/**' | tar x || true
5961
6062
- name: Build Compiler User Guide with mdBook
6163
run: mdbook build

.github/workflows/pr-docs-build.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
rustup update
2727
cargo install --version ${MDBOOK_VERSION} mdbook
2828
29+
- name: Build root book with mdBook
30+
run: mdbook build
31+
2932
- name: Build Compiler User Guide with mdBook
3033
run: mdbook build
3134
working-directory: ./compiler-user-guide
@@ -34,18 +37,13 @@ jobs:
3437
run: mdbook build
3538
working-directory: ./tutorial
3639

37-
- name: Add Index Page
38-
run: |
39-
mkdir -p public
40-
cp index.html ./public/index.html
41-
4240
- name: Deploy to GitHub Pages
4341
uses: peaceiris/actions-gh-pages@v4
4442
with:
4543
github_token: ${{ secrets.GITHUB_TOKEN }}
4644
publish_dir: ./public # The directory mdbook builds to
47-
# Deploy to a subdirectory like "pr-123"
48-
destination_dir: ./pr-${{ github.event.pull_request.number }}
45+
# Deploy to a subdirectory like "pr/123"
46+
destination_dir: ./pr/${{ github.event.pull_request.number }}
4947

5048
# Post a comment on the PR with the link to the preview
5149
- name: Post Preview Link Comment
@@ -54,4 +52,4 @@ jobs:
5452
# Construct the URL for the preview
5553
message: |
5654
Thank you for your PR! A preview of your changes is live at
57-
**[https://docs.clash-lang.org/pr-${{ github.event.pull_request.number }}/](https://docs.clash-lang.org/pr-${{ github.event.pull_request.number }}/)**
55+
**[https://docs.clash-lang.org/pr/${{ github.event.pull_request.number }}/](https://docs.clash-lang.org/pr/${{ github.event.pull_request.number }}/)**

.github/workflows/pr-docs-clean.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Remove PR Preview Directory
2222
run: |
2323
PR_NUMBER=${{ github.event.pull_request.number }}
24-
echo "Removing directory ./pr-${PR_NUMBER}"
25-
rm -rf ./pr-${PR_NUMBER}
24+
echo "Removing directory ./pr/${PR_NUMBER}"
25+
rm -rf ./pr/${PR_NUMBER}
2626
2727
- name: Commit and Push Deletion
2828
uses: peaceiris/actions-gh-pages@v4

book.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[book]
2+
authors = ["The Clash Developers"]
3+
language = "en"
4+
src = "root-src"
5+
title = "Clash Documentation"
6+
7+
[build]
8+
build-dir = "public/"

compiler-user-guide/theme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../theme/

index.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow: /pr/

root-src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Summary
2+
3+
- [Clash Documentation](./index.md)

root-src/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Clash Documentation
2+
3+
Welcome to the Clash Documentation!
4+
5+
Here you can find different types of documentation.
6+
7+
1. [Tutorial](./tutorial/)
8+
2. [Compiler User Guide](./compiler-user-guide/)
File renamed without changes.

0 commit comments

Comments
 (0)