Skip to content
Closed
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
75 changes: 25 additions & 50 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@ name: Documentation
on:
push:
branches:
- develop
- tmp-develop
tags:
- 'v*'
paths:
- 'website/**'
- 'docs/**'
- '.github/workflows/docs.yaml'
pull_request:
paths:
- 'website/**'
- 'docs/**'
- '.github/workflows/docs.yaml'
workflow_dispatch:

env:
NODE_VERSION: '20'

permissions:
contents: read
actions: write
pages: write
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# Test documentation build
test-docs:
docs-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -57,63 +55,34 @@ jobs:
run: make docs-build

- name: Upload build artifacts for testing
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: docs-build-test
name: github-pages
path: website/build
retention-days: 1


# Deploy to GitHub Pages (only on develop branch)
deploy:
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
needs: [test-docs]
if: github.ref == 'refs/heads/tmp-develop' && github.event_name == 'push'
needs: [docs-build]
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

permissions:
contents: read
pages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for versioning

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Setup build dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler
uses: actions/configure-pages@v5

- name: Install documentation dependencies
run: make docs-install

- name: Build documentation
run: |
cd website
# Set base URL for GitHub Pages
echo "Building documentation for GitHub Pages..."
npm run build
env:
NODE_ENV: production

- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
- name: Download built docs
uses: actions/download-artifact@v3
with:
name: github-pages
path: website/build

- name: Deploy to GitHub Pages
Expand All @@ -123,7 +92,7 @@ jobs:
# Create versioned documentation on tag creation
version-docs:
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-docs]
needs: [docs-build]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -132,12 +101,19 @@ jobs:
fetch-depth: 0

- name: Setup Node.js

uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: website/package-lock.json

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
toolchain: nightly

- name: Install dependencies
run: make docs-install

Expand All @@ -161,8 +137,7 @@ jobs:

- name: Build versioned documentation
run: |
cd website
npm run build
make docs-build
env:
NODE_ENV: production

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config: Config = {
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'o1-labs', // Usually your GitHub org/user name.
projectName: 'openmina', // Usually your repo name.
projectName: 'o1-labs.github.io/openmina', // GH address + repository

onBrokenLinks: 'throw', // Throw error on broken links to enforce link integrity
onBrokenMarkdownLinks: 'throw',
Expand Down
Loading