|
| 1 | +name: Deploy website (fast) |
| 2 | + |
| 3 | +# Fast path: builds and deploys ONLY the interactive website (no Lean build), |
| 4 | +# so https://statlean.github.io/website/ goes live in minutes. The doc-gen4 |
| 5 | +# docs are pulled from the shared cache that the full `deploy.yml` workflow |
| 6 | +# populates; if that cache is empty (docs not built yet) the website still |
| 7 | +# deploys and /docs/ becomes available after the first full build. |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + push: |
| 12 | + branches: [main] |
| 13 | + paths: |
| 14 | + - '.github/workflows/website.yml' |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + pages: write |
| 19 | + id-token: write |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: pages |
| 23 | + cancel-in-progress: false |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 30 |
| 29 | + steps: |
| 30 | + - name: Checkout source repository (StatLean/Stat-Lean) |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: StatLean/Stat-Lean |
| 34 | + ref: main |
| 35 | + fetch-depth: 1 |
| 36 | + path: src |
| 37 | + |
| 38 | + - name: Restore docs cache (if a full build has run) |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: site/docs |
| 42 | + key: site-docs-${{ hashFiles('src/lean-toolchain', 'src/lakefile.lean', 'src/lake-manifest.json') }} |
| 43 | + restore-keys: site-docs- |
| 44 | + |
| 45 | + - name: Set up Node |
| 46 | + uses: actions/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: 20 |
| 49 | + cache: npm |
| 50 | + cache-dependency-path: src/website/package-lock.json |
| 51 | + |
| 52 | + - name: Build the website |
| 53 | + working-directory: src/website |
| 54 | + run: | |
| 55 | + npm ci |
| 56 | + npm run build |
| 57 | +
|
| 58 | + - name: Assemble GitHub Pages site |
| 59 | + run: | |
| 60 | + mkdir -p site/docs site/website |
| 61 | + cp -r src/website/dist/* site/website/ |
| 62 | + touch site/.nojekyll |
| 63 | + cat > site/index.html <<'EOF' |
| 64 | + <!doctype html> |
| 65 | + <html lang="en"> |
| 66 | + <head> |
| 67 | + <meta charset="utf-8"> |
| 68 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 69 | + <title>Asymptotic Statistical Theory in Lean 4</title> |
| 70 | + <meta http-equiv="refresh" content="0; url=./website/"> |
| 71 | + <link rel="canonical" href="./website/"> |
| 72 | + <style> |
| 73 | + body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 46rem; margin: 4rem auto; padding: 0 1.25rem; line-height: 1.6; color: #1b1b1b; } |
| 74 | + h1 { font-size: 1.9rem; margin-bottom: 0.25rem; } |
| 75 | + a { color: #b07414; } |
| 76 | + .btn { display: inline-block; margin-top: 1rem; margin-right: 0.5rem; padding: 0.6rem 1.1rem; background: #1b1b1b; color: #fff; border-radius: 999px; text-decoration: none; } |
| 77 | + .btn.alt { background: transparent; color: #1b1b1b; border: 1px solid #ccc; } |
| 78 | + .muted { color: #555; } |
| 79 | + </style> |
| 80 | + </head> |
| 81 | + <body> |
| 82 | + <h1>Asymptotic Statistical Theory in Lean 4</h1> |
| 83 | + <p class="muted">Redirecting to the Stat-Lean website…</p> |
| 84 | + <p> |
| 85 | + <a class="btn" href="./website/">Open the website →</a> |
| 86 | + <a class="btn alt" href="./docs/">API documentation</a> |
| 87 | + </p> |
| 88 | + <p class="muted">Source: |
| 89 | + <a href="https://github.com/StatLean/Stat-Lean">github.com/StatLean/Stat-Lean</a></p> |
| 90 | + </body> |
| 91 | + </html> |
| 92 | + EOF |
| 93 | +
|
| 94 | + - name: Upload GitHub Pages artifact |
| 95 | + uses: actions/upload-pages-artifact@v3 |
| 96 | + with: |
| 97 | + path: site |
| 98 | + |
| 99 | + deploy: |
| 100 | + environment: |
| 101 | + name: github-pages |
| 102 | + url: ${{ steps.deployment.outputs.page_url }} |
| 103 | + runs-on: ubuntu-latest |
| 104 | + needs: build |
| 105 | + steps: |
| 106 | + - name: Deploy to GitHub Pages |
| 107 | + id: deployment |
| 108 | + uses: actions/deploy-pages@v4 |
0 commit comments