Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@ jobs:
id: pages
uses: actions/configure-pages@v5

- name: Build root book with mdBook
run: mdbook build

- name: Add root files
run: |
cp CNAME public/
cp robots.txt public/

- name: Copy PR previews
# If there are no open PR's, this step will emit error messages that no
# files matched and it does not look like a tar archive. These are
# expected and don't indicate a problem.
run: |
mkdir -p public
git fetch --depth=1 origin +gh-pages:refs/remotes/origin/gh-pages
git archive --prefix=public/ refs/remotes/origin/gh-pages -- ':(glob)pr-*/**' | tar x || true

- name: Add root files
run: |
cp CNAME public/
cp index.html public/
git archive --prefix=public/ refs/remotes/origin/gh-pages -- ':(glob)pr/**' | tar x || true

- name: Build Compiler User Guide with mdBook
run: mdbook build
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/pr-docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
rustup update
cargo install --version ${MDBOOK_VERSION} mdbook

- name: Build root book with mdBook
run: mdbook build

- name: Build Compiler User Guide with mdBook
run: mdbook build
working-directory: ./compiler-user-guide
Expand All @@ -34,18 +37,13 @@ jobs:
run: mdbook build
working-directory: ./tutorial

- name: Add Index Page
run: |
mkdir -p public
cp index.html ./public/index.html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public # The directory mdbook builds to
# Deploy to a subdirectory like "pr-123"
destination_dir: ./pr-${{ github.event.pull_request.number }}
# Deploy to a subdirectory like "pr/123"
destination_dir: ./pr/${{ github.event.pull_request.number }}

# Post a comment on the PR with the link to the preview
- name: Post Preview Link Comment
Expand All @@ -54,4 +52,4 @@ jobs:
# Construct the URL for the preview
message: |
Thank you for your PR! A preview of your changes is live at
**[https://docs.clash-lang.org/pr-${{ github.event.pull_request.number }}/](https://docs.clash-lang.org/pr-${{ github.event.pull_request.number }}/)**
**[https://docs.clash-lang.org/pr/${{ github.event.pull_request.number }}/](https://docs.clash-lang.org/pr/${{ github.event.pull_request.number }}/)**
4 changes: 2 additions & 2 deletions .github/workflows/pr-docs-clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Remove PR Preview Directory
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
echo "Removing directory ./pr-${PR_NUMBER}"
rm -rf ./pr-${PR_NUMBER}
echo "Removing directory ./pr/${PR_NUMBER}"
rm -rf ./pr/${PR_NUMBER}

- name: Commit and Push Deletion
uses: peaceiris/actions-gh-pages@v4
Expand Down
8 changes: 8 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[book]
authors = ["The Clash Developers"]
language = "en"
src = "root-src"
title = "Clash Documentation"

[build]
build-dir = "public/"
1 change: 1 addition & 0 deletions compiler-user-guide/theme
10 changes: 0 additions & 10 deletions index.html

This file was deleted.

2 changes: 2 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /pr/
3 changes: 3 additions & 0 deletions root-src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Summary

- [Clash Documentation](./index.md)
8 changes: 8 additions & 0 deletions root-src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Clash Documentation

Welcome to the Clash Documentation!

Here you can find different types of documentation.

1. [Tutorial](./tutorial/)
2. [Compiler User Guide](./compiler-user-guide/)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tutorial/theme
Loading