Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflows for publishing to GH Pages #13

Merged
merged 5 commits into from
Jun 6, 2024
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
28 changes: 28 additions & 0 deletions .github/actions/build-mdbook/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build the mdBook
description: Generate static site from markdown files through mdBook

runs:
using: "composite"
steps:
- name: Create bin directory and add to $PATH
run: |
mkdir bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
shell: bash
- name: Install mdbook
run: |
url="https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz"
curl -sSL "$url" | tar -xz --directory=bin
shell: bash
- name: Install mdbook-linkcheck
run: |
url="https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip"
curl -sSL "$url" -o mdbook-linkcheck.zip
unzip "$_" -d bin
chmod +x bin/mdbook-linkcheck
shell: bash
- name: Build the book and check for broken links
run: mdbook build
env:
RUST_LOG: INFO
shell: bash
File renamed without changes.
28 changes: 28 additions & 0 deletions .github/workflows/pages-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and deploy GitHub Pages
on:
push:
branches:
- "main"
paths:
- "book.toml"
- "docs/**"
- ".github/actions/build-mdbook/action.yaml"
- ".github/workflows/pages-deploy.yaml"

concurrency: ci-${{ github.ref }}

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-mdbook
- name: Deploy
uses: JamesIves/[email protected]
with:
folder: build/html
clean-exclude: pr-preview/
force: false
33 changes: 33 additions & 0 deletions .github/workflows/pages-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and deploy GitHub Pages preview for PRs

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
paths:
- "book.toml"
- "docs/**"
- ".github/actions/build-mdbook/action.yaml"
- ".github/workflows/pages-preview.yaml"


concurrency: preview-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-mdbook
if: github.event.action != 'closed'
- name: Deploy preview
uses: rossjrw/[email protected]
with:
source-dir: build/html
File renamed without changes.
10 changes: 10 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ title = "Walrus"

[build]
build-dir = "build"

[output.html]

[output.linkcheck]
optional = true
follow-web-links = true
warning-policy = "error"
exclude = [
'github\.com/MystenLabs/walrus-docs/', # Currently still private
]