Website: add sections with transactions #1176
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
name: Documentation | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- 'v*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
NODE_VERSION: '20' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Test documentation build | |
build-docs: | |
if: github.ref != 'refs/heads/develop' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
- name: Setup Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
cache-dependency-path: website/package-lock.json | |
- name: Setup build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y protobuf-compiler ocaml | |
- name: Install documentation dependencies | |
run: make docs-install | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
# This should be in line with the verison in: | |
# - Makefile | |
# - ./github/workflows/docs.yaml | |
# - ./github/workflows/fmt.yaml | |
# - ./github/workflows/lint.yaml | |
toolchain: nightly | |
- name: Verify code references in documentation (PR mode) | |
if: github.event_name == 'pull_request' | |
id: verify-pr | |
run: | | |
bash .github/scripts/verify-code-references.sh --pr-comment /tmp/pr-comment.md | |
if [ -f /tmp/pr-comment.md ]; then | |
echo "has_comment=true" >> $GITHUB_OUTPUT | |
echo "Comment file created, will post to PR" | |
cat /tmp/pr-comment.md | |
else | |
echo "has_comment=false" >> $GITHUB_OUTPUT | |
echo "No comment file created" | |
fi | |
- name: Comment PR with verification results | |
if: github.event_name == 'pull_request' && steps.verify-pr.outputs.has_comment == 'true' | |
uses: thollander/actions-comment-pull-request@v3 | |
with: | |
file-path: /tmp/pr-comment.md | |
comment-tag: code-reference-verification | |
- name: Verify code references in documentation (non-PR mode) | |
if: github.event_name != 'pull_request' | |
run: bash .github/scripts/verify-code-references.sh | |
- name: Build documentation | |
run: make docs-build | |
- name: Upload build artifacts for testing | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-build-test | |
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' | |
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@v5 | |
with: | |
fetch-depth: 0 # Full history for versioning | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Setup Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
cache-dependency-path: website/package-lock.json | |
- name: Setup build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y protobuf-compiler | |
- name: Install documentation dependencies | |
run: make docs-install | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
# This should be in line with the verison in: | |
# - Makefile | |
# - ./github/workflows/docs.yaml | |
# - ./github/workflows/fmt.yaml | |
# - ./github/workflows/lint.yaml | |
toolchain: nightly | |
- name: Build documentation | |
run: make docs-build | |
- name: Upload to GitHub Pages | |
uses: actions/upload-pages-artifact@v4 | |
with: | |
path: website/build | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
# Create versioned documentation on tag creation | |
version-docs: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [build-docs] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
cache-dependency-path: website/package-lock.json | |
- name: Install dependencies | |
run: make docs-install | |
- name: Extract version from tag | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Creating version $VERSION" | |
- name: Create versioned documentation | |
run: | | |
cd website | |
# Create a new version of the documentation | |
npm run docusaurus docs:version ${{ steps.version.outputs.version }} | |
- name: Setup build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y protobuf-compiler | |
- name: Build versioned documentation | |
run: | | |
cd website | |
npm run build | |
env: | |
NODE_ENV: production | |
- name: Create versioned documentation archive | |
run: | | |
cd website/build | |
tar -czf "../../mina-docs-${{ steps.version.outputs.version }}.tar.gz" . | |
cd ../.. | |
zip -r "mina-docs-${{ steps.version.outputs.version }}.zip" website/build | |
- name: Upload versioned documentation as release asset | |
uses: actions/upload-artifact@v4 | |
with: | |
name: versioned-docs-${{ steps.version.outputs.version }} | |
path: | | |
mina-docs-${{ steps.version.outputs.version }}.tar.gz | |
mina-docs-${{ steps.version.outputs.version }}.zip |