-
Notifications
You must be signed in to change notification settings - Fork 21
ci(docs): publish mdbook to GitHub Pages #331
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
Open
MegaRedHand
wants to merge
8
commits into
main
Choose a base branch
from
ci/mdbook-gh-pages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+120
−2
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f8a537e
ci(docs): publish mdbook to GitHub Pages
MegaRedHand 0598f22
ci(docs): use linkcheck2 instead of lychee for link checks
MegaRedHand c370f84
chore(docs-deps): pin transitive deps with --locked
MegaRedHand 13c6815
ci(docs): re-add lychee for external URL checking
MegaRedHand 52cf715
ci(docs): tighten permissions and concurrency on mdbook workflow
MegaRedHand a877ef4
ci(docs): drop Makefile from path filters
MegaRedHand 301bd62
ci(docs): bump upload/download-artifact to current majors
MegaRedHand 27cb0e0
ci(docs): exclude eprint.iacr.org from lychee
MegaRedHand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # Modeled on ethrex's mdbook publish workflow: | ||
| # https://github.com/lambdaclass/ethrex/blob/728dc7ded560c665ab1ff2cf7f3eeb197b5bc40f/.github/workflows/pr-main_mdbook.yml | ||
| name: Publish ethlambda docs to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "docs/**" | ||
| - "book.toml" | ||
| - ".github/workflows/pr-main_mdbook.yml" | ||
| pull_request: | ||
| paths: | ||
| - "docs/**" | ||
| - "book.toml" | ||
| - ".github/workflows/pr-main_mdbook.yml" | ||
| workflow_dispatch: | ||
|
|
||
| # Default to least privilege; only the deploy job upgrades to write to push the | ||
| # gh-pages branch. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: ${{ github.workflow }}-build-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup mdBook | ||
| uses: peaceiris/actions-mdbook@v2 | ||
| with: | ||
| mdbook-version: "0.5.2" | ||
|
|
||
| - name: Setup Rust | ||
| uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Cache cargo install | ||
| uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| cache-targets: false | ||
|
|
||
| # mdbook-linkcheck2 runs as part of `mdbook build` and fails the build | ||
| # on broken internal links (see book.toml `warning-policy = "error"`). | ||
| - name: Install mdbook-linkcheck2 | ||
| run: cargo install --version 0.12.0 --locked mdbook-linkcheck2 | ||
|
|
||
| - name: Build documentation | ||
| run: make docs | ||
|
|
||
| - name: Upload docs artifact | ||
| if: ${{ github.ref == 'refs/heads/main' }} | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: docs | ||
| path: book/html | ||
| retention-days: 1 | ||
|
|
||
| # Internal links are validated by mdbook-linkcheck2 inside the build step. | ||
| # This job validates external URLs, which linkcheck2 skips by default | ||
| # (follow-web-links = false) to keep local builds fast and offline-friendly. | ||
| link-check: | ||
| name: Link Check | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Check links | ||
| uses: lycheeverse/lychee-action@v2 | ||
| with: | ||
| # eprint.iacr.org returns 403 to non-browser User-Agents (anti-bot | ||
| # protection on the IACR preprint server); the URLs themselves are | ||
| # valid in a real browser. | ||
| args: >- | ||
| --no-progress | ||
| --exclude 'localhost' | ||
| --exclude '127\.0\.0\.1' | ||
| --exclude 'eprint\.iacr\.org' | ||
| docs/ | ||
| fail: true | ||
|
|
||
| deploy: | ||
| name: Deploy | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: ${{ github.ref == 'refs/heads/main' }} | ||
| permissions: | ||
| contents: write | ||
| concurrency: | ||
| group: ${{ github.workflow }}-deploy-${{ github.ref }} | ||
| cancel-in-progress: false | ||
| steps: | ||
| - name: Download docs artifact | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: docs | ||
| path: book/html | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: book/html | ||
| destination_dir: . | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.