Skip to content

Fix/lint and ts errors #126

Fix/lint and ts errors

Fix/lint and ts errors #126

Workflow file for this run

name: Documentation
on:
push:
branches: [main]
paths: ['docs/**', 'src/**', 'README.md', 'CONTRIBUTING.md']
pull_request:
branches: [main]
paths: ['docs/**', 'src/**', 'README.md', 'CONTRIBUTING.md']
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Enable Corepack
run: corepack enable
- name: Setup Yarn version
run: corepack prepare yarn@3.6.1 --activate
- name: Unplug chalk to attempt to fix CJS/ESM issues
run: yarn unplug chalk
- name: Clean root Yarn install state
run: rm -f .yarn/install-state.gz
- name: Clean Yarn cache
run: yarn cache clean --all
- name: Install dependencies
run: yarn install --immutable
- name: Clean docs workspace before install
working-directory: docs
run: |
rm -rf node_modules yarn.lock .pnp.* .yarn/cache .yarn/build-state.yml
echo "Docs workspace cleaned."
- name: Install docs dependencies
working-directory: docs
run: yarn install --immutable
- name: Build SDK for API docs
run: yarn build
- name: Generate API documentation
run: |
echo "Generating API documentation..."
yarn docs:generate
- name: Build documentation
working-directory: docs
run: |
echo "Node version:"
node --version
echo "Yarn version:"
yarn --version
echo "Building Docusaurus documentation..."
yarn build
- name: Upload documentation artifacts
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build/
retention-days: 7
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: build-docs
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation
path: ./docs-build
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
link-checker:
name: Check Documentation Links
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation
path: ./docs-build
- name: Check links
uses: lycheeverse/lychee-action@v2
with:
args: |
--accept 200,204,429
--exclude-path node_modules
--exclude-path .git
--exclude linkedin.com
--exclude twitter.com
--exclude discord.gg
--timeout 30
--retry-wait-time 5
--max-retries 3
./docs-build/**/*.html
fail: true
lighthouse-audit:
name: Lighthouse Performance Audit
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: documentation
path: ./docs-build
- name: Serve documentation locally
run: |
echo "Starting HTTP server for documentation..."
npx http-server ./docs-build -p 8080 --silent &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
sleep 10
# Check if server is running
if curl -f -s http://localhost:8080 > /dev/null; then
echo "✅ Server started successfully on port 8080"
else
echo "❌ Server failed to start"
kill $SERVER_PID 2>/dev/null || true
exit 1
fi
# Store PID for cleanup
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
- name: Run Lighthouse audit
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
http://localhost:8080
http://localhost:8080/docs/getting-started
http://localhost:8080/docs/api-reference
uploadArtifacts: true
temporaryPublicStorage: true
- name: Cleanup server
if: always()
run: |
if [ ! -z "$SERVER_PID" ]; then
echo "Stopping HTTP server (PID: $SERVER_PID)"
kill $SERVER_PID 2>/dev/null || true
fi