|
7 | 7 |
|
8 | 8 | permissions: |
9 | 9 | contents: write # create release & upload assets |
| 10 | + pages: write # deploy pages |
10 | 11 | id-token: write # needed for provenance |
11 | 12 | attestations: write # needed for provenance |
12 | 13 |
|
13 | 14 | jobs: |
14 | | - build-and-release: |
| 15 | + build: |
15 | 16 | runs-on: ubuntu-latest |
16 | 17 | steps: |
17 | | - - name: Checkout |
18 | | - uses: actions/checkout@v4 |
19 | | - with: |
20 | | - fetch-depth: 0 |
21 | | - |
22 | | - - name: Setup Bun |
23 | | - uses: oven-sh/setup-bun@v2 |
| 18 | + - uses: actions/checkout@v5 |
| 19 | + - uses: oven-sh/setup-bun@v2 |
| 20 | + - uses: actions/configure-pages@v5 |
24 | 21 |
|
25 | 22 | - name: Install deps |
26 | | - run: bun install |
| 23 | + run: bun install --frozen-lockfile |
27 | 24 |
|
28 | | - - name: Build single-file HTML |
| 25 | + - name: Build |
29 | 26 | run: | |
30 | 27 | bun build-dist |
31 | | - # Ensure output is at dist/index.html |
32 | 28 | test -f dist/index.html |
33 | 29 |
|
34 | | - - name: Embed version (optional) |
| 30 | + - name: Embed version |
35 | 31 | run: | |
36 | | - ver="${GITHUB_REF_NAME}" # e.g. v1.2.0 |
| 32 | + ver="${GITHUB_REF_NAME}" |
37 | 33 | printf '\n<!-- version: %s commit: %s -->\n' "$ver" "$GITHUB_SHA" >> dist/index.html |
38 | 34 |
|
39 | 35 | - name: Generate checksum |
40 | 36 | run: | |
41 | 37 | cd dist |
42 | 38 | sha256sum index.html | tee index.sha256 |
43 | 39 |
|
| 40 | + - name: Upload job artifact |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + with: |
| 43 | + name: site-dist |
| 44 | + path: dist |
| 45 | + if-no-files-found: error |
| 46 | + |
| 47 | + - name: Upload Pages artifact |
| 48 | + uses: actions/upload-pages-artifact@v4 |
| 49 | + with: |
| 50 | + path: dist |
| 51 | + |
| 52 | + release: |
| 53 | + needs: build |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - name: Download build artifact |
| 57 | + uses: actions/download-artifact@v5 |
| 58 | + with: |
| 59 | + name: site-dist |
| 60 | + path: dist |
| 61 | + |
44 | 62 | - name: Create GitHub Release |
45 | 63 | id: create_release |
46 | 64 | uses: softprops/action-gh-release@v2 |
|
54 | 72 | dist/index.html |
55 | 73 | dist/index.sha256 |
56 | 74 |
|
57 | | - - name: Attest build provenance (SLSA/GH provenance) |
58 | | - uses: actions/attest-build-provenance@v1 |
| 75 | + - name: Attest build provenance |
| 76 | + uses: actions/attest-build-provenance@v3 |
59 | 77 | with: |
60 | 78 | subject-path: "dist/index.html" |
| 79 | + |
| 80 | + deploy_pages: |
| 81 | + needs: build |
| 82 | + runs-on: ubuntu-latest |
| 83 | + environment: |
| 84 | + name: github-pages |
| 85 | + url: ${{ steps.deployment.outputs.page_url }} |
| 86 | + steps: |
| 87 | + - id: deployment |
| 88 | + uses: actions/deploy-pages@v4 |
0 commit comments