Skip to content
Merged
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
78 changes: 78 additions & 0 deletions .github/workflows/rustdoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish rustdoc

on:
push:
branches:
- master

# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@1.85.0

- name: Configure cache
uses: Swatinem/rust-cache@v2

- name: Setup pages
id: pages
uses: actions/configure-pages@v5

- name: Clean docs folder
run: cargo clean --doc

- name: Build docs
run: cargo doc --no-deps --document-private-items --workspace

- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0;url=nargo/index.html">' > target/doc/index.html

- name: Remove lock file
run: rm target/doc/.lock

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rustdoc
path: target/doc

deploy:
name: Deploy
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages

- name: Clear old docs
run: rm -rf ./docs

- name: Download rustdoc output
uses: actions/download-artifact@v4
with:
name: rustdoc
path: ./docs

- name: Configure git
run: |
git config --global user.name "rustdoc"
git config --global user.email "github@users.noreply.github.com"

- name: Commit new docs
run: |
# This could _potentially_ clash with pushing benchmarks to this branch at the same time.
# In practice, this will complete much sooner than the benchmarks are generated.
git add ./docs/*
git commit -m "update rustdoc"
git push
Loading