name: Documentation
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
uses: dtolnay/rust-action@stable
with:
toolchain: nightly
- name: Build documentation
run: cargo doc --all-features --no-deps
env:
RUSTDOCFLAGS: "--cfg docsrs"
- name: Create redirect page
run: |
echo '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=nomad_protocol/index.html">
<title>NOMAD Protocol Documentation</title>
</head>
<body>
<p>Redirecting to <a href="nomad_protocol/index.html">NOMAD Protocol Documentation</a>...</p>
</body>
</html>' > target/doc/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4