innodb-utils 5.1.0

InnoDB file analysis toolkit
Documentation
name: Deploy Web UI & Docs

on:
  push:
    branches: [master]
    paths:
      - 'src/**'
      - 'web/**'
      - 'docs/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/pages.yml'

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

concurrency:
  group: pages
  cancel-in-progress: true

jobs:
  build-and-deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - uses: jetli/wasm-pack-action@v0.4.0

      - name: Install Binaryen (wasm-opt)
        run: |
          BINARYEN_VERSION=119
          curl -sSL "https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz" | tar -xz
          sudo mv binaryen-version_${BINARYEN_VERSION}/bin/wasm-opt /usr/local/bin/

      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
          cache-dependency-path: web/package-lock.json

      - name: Build WASM package
        run: wasm-pack build --release --target web --no-default-features

      - name: Optimize WASM
        run: wasm-opt -O --enable-bulk-memory pkg/idb_bg.wasm -o pkg/idb_bg.wasm

      - name: Install web dependencies
        run: cd web && npm ci

      - name: Build web UI
        run: cd web && npm run build

      - name: Install mdBook
        run: |
          MDBOOK_VERSION=0.4.40
          curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz
          sudo mv mdbook /usr/local/bin/

      - name: Build documentation
        run: mdbook build docs

      - name: Copy docs into web dist
        run: |
          mkdir -p web/dist/book
          if [ -d docs/book/html ]; then
            cp -r docs/book/html/* web/dist/book/
          else
            cp -r docs/book/* web/dist/book/
          fi

      - uses: actions/configure-pages@v5

      - uses: actions/upload-pages-artifact@v4
        with:
          path: web/dist

      - id: deployment
        uses: actions/deploy-pages@v4