Skip to content
Latchkey

Documentation & Examples workflow (melonjs/melonJS)

The Documentation & Examples workflow from melonjs/melonJS, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: melonjs/melonJS.github/workflows/docs.ymlLicense MITView source

What it does

This is the Documentation & Examples workflow from the melonjs/melonJS repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Documentation & Examples
on:
  push:
    branches: [master]

concurrency:
  group: docs-${{ github.ref }}
  cancel-in-progress: true

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

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Setup node
        uses: actions/setup-node@v6
        with:
          node-version: 24
      - uses: pnpm/action-setup@v5
      - name: Get pnpm store directory
        run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
      - uses: actions/cache@v5
        with:
          path: ${{ env.STORE_PATH }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: ${{ runner.os }}-pnpm-store-
      - run: pnpm i
      - name: Build melonjs
        run: pnpm -F melonjs build
      - name: Build debug plugin
        run: pnpm -F @melonjs/debug-plugin build
      - name: Build tiled-inflate-plugin
        run: pnpm -F @melonjs/tiled-inflate-plugin build
      - name: Build spine-plugin
        run: pnpm -F @melonjs/spine-plugin build
      - name: Build matter-adapter
        run: pnpm -F @melonjs/matter-adapter build
      - name: Build planck-adapter
        run: pnpm -F @melonjs/planck-adapter build
      - name: Build API docs
        run: pnpm doc
      - name: Build examples
        run: pnpm -F examples build
        env:
          VITE_BASE_PATH: /melonJS/examples/
      - name: Combine docs and examples
        run: |
          mkdir -p packages/melonjs/docs/examples
          cp -r packages/examples/dist/* packages/melonjs/docs/examples/
      - name: Upload GitHub Pages artifact
        uses: actions/upload-pages-artifact@v4
        with:
          path: packages/melonjs/docs/

  deploy:
    runs-on: ubuntu-latest
    needs: build
    permissions:
      pages: write
      id-token: write
    environment:
      name: api-reference
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Documentation & Examples
on:
  push:
    branches: [master]
 
concurrency:
  group: docs-${{ github.ref }}
  cancel-in-progress: true
 
permissions:
  contents: read
  pages: write
  id-token: write
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v5
      - name: Setup node
        uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version: 24
      - uses: pnpm/action-setup@v5
      - name: Get pnpm store directory
        run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
      - uses: actions/cache@v5
        with:
          path: ${{ env.STORE_PATH }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: ${{ runner.os }}-pnpm-store-
      - run: pnpm i
      - name: Build melonjs
        run: pnpm -F melonjs build
      - name: Build debug plugin
        run: pnpm -F @melonjs/debug-plugin build
      - name: Build tiled-inflate-plugin
        run: pnpm -F @melonjs/tiled-inflate-plugin build
      - name: Build spine-plugin
        run: pnpm -F @melonjs/spine-plugin build
      - name: Build matter-adapter
        run: pnpm -F @melonjs/matter-adapter build
      - name: Build planck-adapter
        run: pnpm -F @melonjs/planck-adapter build
      - name: Build API docs
        run: pnpm doc
      - name: Build examples
        run: pnpm -F examples build
        env:
          VITE_BASE_PATH: /melonJS/examples/
      - name: Combine docs and examples
        run: |
          mkdir -p packages/melonjs/docs/examples
          cp -r packages/examples/dist/* packages/melonjs/docs/examples/
      - name: Upload GitHub Pages artifact
        uses: actions/upload-pages-artifact@v4
        with:
          path: packages/melonjs/docs/
 
  deploy:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs: build
    permissions:
      pages: write
      id-token: write
    environment:
      name: api-reference
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow