euv-docs 0.1.7

A VuePress-style documentation site generator powered by euv + euv-ui (Rust/WASM).
Documentation
name: Deploy Pages

on:
  workflow_run:
    workflows: [Deploy to GitHub Pages]
    types: [completed]
    branches: [master]
  workflow_dispatch:

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

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

jobs:
  build:
    if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
    runs-on: ubuntu-latest
    steps:
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v5

      - uses: actions/checkout@v4

      - name: Setup Rust (with wasm32 target)
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      - name: Install wasm-pack (prebuilt)
        uses: taiki-e/install-action@v2
        with:
          tool: wasm-pack

      - name: Install euv-cli
        run: cargo install euv-cli --locked

      - name: Build site (euv build → www/)
        run: euv build --release --index-html template.html -- --target web --out-dir www/pkg --out-name euv_docs --no-typescript --no-pack --no-gitignore

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: www

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

      - name: Sync Pages
        run: |
          max_retries=60
          retry_delay=60
          for i in $(seq 1 $max_retries); do
            if curl -sf -X POST https://ltpp.vip/api/github/pages/sync/euv-dev/euv-docs \
              -H "Connection: close"; then
              echo ""
              echo "Sync succeeded on attempt $i"
              exit 0
            fi
            echo "Attempt $i of $max_retries failed"
            if [ $i -lt $max_retries ]; then
              echo "Retrying in ${retry_delay}s..."
              sleep $retry_delay
            fi
          done
          echo "All $max_retries attempts failed"
          exit 1