Skip to content

Commit

Permalink
Add GitHub pages script
Browse files Browse the repository at this point in the history
  • Loading branch information
EridianAlpha committed Oct 14, 2024
1 parent 0df96b0 commit 64c7ef8
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deployGitHubPages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy Docs to GitHub Pages

on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Dependencies
run: forge install

- name: Generate Documentation
run: forge doc

- name: Edit book.toml
run: |
sed -i 's/title = ""/title = "Pool Playground"/' ./docs/book.toml # Set the title of the book
sed -i 's/authors = \[\]/authors = \["EridianAlpha"\]/' ./docs/book.toml # Set the author of the book
sed -i '/\[book\]/a language = "en"' ./docs/book.toml # Add language setting under [book]
sed -i '/\[book\]/a multilingual = false' ./docs/book.toml # Add multilingual setting under [book]
sed -i 's/no-section-label = true/no-section-label = false/' ./docs/book.toml # Change no-section-label to false
sed -i '/\[output.html\]/a default-theme = "dark"' ./docs/book.toml # Add default-theme under [output.html]
sed -i '/\[output.html\]/a preferred-dark-theme = "ayu"' ./docs/book.toml # Add preferred-dark-theme under [output.html]
sed -i '/^\[output.html.fold\]$/,/^\[/ s/^enable = true/enable = false/' ./docs/book.toml # Change enable under [output.html.fold]
- name: Edit SUMMARY.md
run: |
sed -i 's/❱ //g' ./docs/src/SUMMARY.md # Removes the "❱ " from lines
sed -i '/^# src$/d' ./docs/src/SUMMARY.md # Deletes the line containing exactly "# src"
sed -i 's/- \[Home\](README.md)/[README](README.md)/' ./docs/src/SUMMARY.md # Replaces "- [Home](README.md)" with "[README](README.md)"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build book
run: |
cd ./docs
mdbook build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book

0 comments on commit 64c7ef8

Please sign in to comment.