| 1 | name: Website and public releases |
| 2 | on: |
| 3 | push: |
| 4 | branches: [main] |
| 5 | paths: ['www/**', 'assets/**', 'README*.md', 'docs/guide/**', 'scripts/agent-*.mjs', 'scripts/verify-macos-release.sh', '.github/workflows/www.yml'] |
| 6 | pull_request: |
| 7 | paths: ['www/**', 'assets/**', 'README*.md', 'docs/guide/**', 'scripts/agent-*.mjs', 'scripts/verify-macos-release.sh', '.github/workflows/www.yml'] |
| 8 | release: |
| 9 | types: [published] |
| 10 | workflow_dispatch: |
| 11 | inputs: |
| 12 | release_tag: |
| 13 | description: 'Optional public release tag to download and verify before deployment' |
| 14 | required: false |
| 15 | type: string |
| 16 | workflow_call: |
| 17 | inputs: |
| 18 | release_tag: |
| 19 | description: Exact published Cage release to verify and deploy |
| 20 | required: true |
| 21 | type: string |
| 22 | permissions: |
| 23 | contents: read |
| 24 | concurrency: |
| 25 | group: website-${{ github.event_name }}-${{ inputs.release_tag || github.event.release.tag_name || github.ref }} |
| 26 | cancel-in-progress: false |
| 27 | jobs: |
| 28 | verify-release: |
| 29 | if: (github.event_name == 'release' && !github.event.release.draft) || (github.event_name == 'workflow_dispatch' && inputs.release_tag != '') |
| 30 | runs-on: macos-15 |
| 31 | timeout-minutes: 15 |
| 32 | steps: |
| 33 | |
| 34 | - uses: actions/checkout@v4 |
| 35 | with: |
| 36 | ref: main |
| 37 | persist-credentials: false |
| 38 | - uses: actions/setup-node@v4 |
| 39 | with: |
| 40 | node-version: 24 |
| 41 | - name: Download public assets and verify SHA-256 |
| 42 | env: |
| 43 | RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} |
| 44 | run: node www/scripts/sync-release.mjs --tag "$RELEASE_TAG" --output "$RUNNER_TEMP/release.json" --archive-directory "$RUNNER_TEMP/release" |
| 45 | - name: Verify the shipped macOS application |
| 46 | run: bash scripts/verify-macos-release.sh "$RUNNER_TEMP/release" |
| 47 | build: |
| 48 | needs: verify-release |
| 49 | if: always() && !cancelled() && (needs.verify-release.result == 'success' || needs.verify-release.result == 'skipped') |
| 50 | runs-on: ubuntu-latest |
| 51 | timeout-minutes: 15 |
| 52 | steps: |
| 53 | - uses: actions/checkout@v4 |
| 54 | with: |
| 55 | ref: ${{ github.event_name == 'release' && 'main' || github.ref }} |
| 56 | persist-credentials: false |
| 57 | - uses: actions/setup-node@v4 |
| 58 | with: |
| 59 | node-version: 24 |
| 60 | cache: npm |
| 61 | cache-dependency-path: www/package-lock.json |
| 62 | - run: npm ci --prefix www |
| 63 | - run: node --test www/scripts/sync-release.test.mjs |
| 64 | - name: Agent package discovery and verification |
| 65 | run: node --test scripts/agent-bootstrap.test.mjs |
| 66 | - name: Resolve the public download version |
| 67 | env: |
| 68 | RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} |
| 69 | run: | |
| 70 | if [[ -n "$RELEASE_TAG" ]]; then |
| 71 | node www/scripts/sync-release.mjs --tag "$RELEASE_TAG" |
| 72 | else |
| 73 | node www/scripts/sync-release.mjs |
| 74 | fi |
| 75 | - run: npm run --prefix www check |
| 76 | - run: npm run --prefix www build |
| 77 | - run: node www/scripts/check-site.mjs |
| 78 | - uses: actions/upload-pages-artifact@v4 |
| 79 | with: |
| 80 | path: www/dist |
| 81 | deploy: |
| 82 | needs: build |
| 83 | if: always() && needs.build.result == 'success' && (github.event_name == 'workflow_dispatch' || github.event_name == 'release') && (github.ref == 'refs/heads/main' || github.event_name == 'release') |
| 84 | runs-on: ubuntu-latest |
| 85 | timeout-minutes: 10 |
| 86 | concurrency: |
| 87 | group: github-pages |
| 88 | cancel-in-progress: false |
| 89 | permissions: |
| 90 | pages: write |
| 91 | id-token: write |
| 92 | environment: |
| 93 | name: github-pages |
| 94 | url: ${{ steps.deployment.outputs.page_url }} |
| 95 | steps: |
| 96 | - name: Deploy GitHub Pages |
| 97 | id: deployment |
| 98 | uses: actions/deploy-pages@v4 |