feat: add initial rustdocs workflow #8
Workflow file for this run
This file contains 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
name: Build and Deploy Crate Docs to Vercel | |
on: | |
push: | |
branches: [main] | |
tags: | |
- v*.*.* | |
pull_request: | |
branches: [main] | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
jobs: | |
docs: | |
permissions: | |
contents: write | |
packages: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
runs-on: | |
- runs-on=${{ github.run_id }} | |
- runner=8cpu-linux-arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
# TEMPORARY | |
- name: Give GitHub Actions access to private repositories | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: | | |
${{ secrets.GH_ACTIONS_DEPLOY_PRIVATE_KEY }} | |
- name: Build documentation | |
run: cargo doc --workspace | |
- name: Build index page | |
run: cargo doc --workspace --no-deps --exclude "openvm-benchmarks" | |
env: | |
RUSTDOCFLAGS: --enable-index-page -Zunstable-options | |
# TODO: make a special tag for doc commit when pushing v*.*.* tags | |
- name: Install Vercel CLI | |
run: npm install -g vercel | |
- name: Deploy to Vercel | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} # Token stored in GitHub Secrets | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
run: | | |
cd target/doc | |
mkdir .vercel | |
echo "{\"projectId\":\"$VERCEL_PROJECT_ID\",\"orgId\":\"$VERCEL_ORG_ID\"}" > .vercel/project.json | |
vercel --prod --token $VERCEL_TOKEN |