Skip to content

Merge pull request #177 from link-foundation/issue-97-cb419b9265e4 #73

Merge pull request #177 from link-foundation/issue-97-cb419b9265e4

Merge pull request #177 from link-foundation/issue-97-cb419b9265e4 #73

Workflow file for this run

name: api-docs
on:
pull_request:
branches: [main]
paths:
- '.github/workflows/api-docs.yml'
- 'docs/api/**'
- 'docs/playground/**'
- 'js/**'
- 'rust/**'
- 'scripts/docs.test.mjs'
- 'scripts/build-playground.mjs'
- 'scripts/playground.test.mjs'
- 'scripts/write-docs-index.mjs'
- 'README.md'
push:
branches: [main]
paths:
- '.github/workflows/api-docs.yml'
- 'docs/api/**'
- 'docs/playground/**'
- 'js/**'
- 'rust/**'
- 'scripts/docs.test.mjs'
- 'scripts/build-playground.mjs'
- 'scripts/playground.test.mjs'
- 'scripts/write-docs-index.mjs'
- 'README.md'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
cache-dependency-path: js/package-lock.json
- name: Install JavaScript dependencies
working-directory: js
run: npm ci
- name: Build browser playground runtime
working-directory: js
run: npm run build:playground
- name: Run playground regression tests
working-directory: js
run: npm run test:playground
- name: Build JavaScript API docs
working-directory: js
run: npm run docs -- --destination ../_site/api/js
- name: Build Rust API docs
run: cargo doc --manifest-path rust/Cargo.toml --no-deps --target-dir target/api-docs/rust
- name: Copy Rust API docs
run: |
mkdir -p _site/api/rust
cp -R target/api-docs/rust/doc/. _site/api/rust/
- name: Add reference docs landing page
run: node scripts/write-docs-index.mjs _site
- name: List built site (debug)
run: |
echo "::group::_site tree"
find _site -maxdepth 3 -print
echo "::endgroup::"
echo "::group::_site/playground listing"
ls -la _site/playground || echo "no _site/playground directory"
echo "::endgroup::"
- name: Configure GitHub Pages
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch'
uses: actions/configure-pages@v6
- name: Upload GitHub Pages artifact
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch'
uses: actions/upload-pages-artifact@v5
with:
path: _site
deploy:
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
- name: Print resolved deployment URL (debug)
run: |
echo "Pages deployed to: ${{ steps.deployment.outputs.page_url }}"
echo "Playground should be reachable at: ${{ steps.deployment.outputs.page_url }}playground/"