Capture store assets #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Capture store assets | |
| # Regenerates the CWS/social assets from the BUILT extension entirely in CI — | |
| # no local browser or Node needed: Actions tab → "Capture store assets" → | |
| # Run workflow → download the `store-assets` artifact. Because shotkit loads | |
| # the shipped bundle, a green run doubles as a real-bundle smoke test (a | |
| # screenshot only appears if that feature actually rendered). | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| scene: | |
| description: 'Only this scene/tile/demo (comma-separated; empty = all)' | |
| required: false | |
| default: '' | |
| video: | |
| description: 'Record the demo screencast (webm)' | |
| type: boolean | |
| default: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| capture: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| # Cache the Chromium binary so re-runs skip the ~120MB download. | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| playwright-${{ runner.os }}- | |
| - name: Install Playwright Chromium (conditional on cache) | |
| run: | | |
| if [ "${{ steps.playwright-cache.outputs.cache-hit }}" != "true" ]; then | |
| npx playwright install --with-deps chromium | |
| else | |
| npx playwright install-deps chromium | |
| fi | |
| # Inputs flow via env (never interpolated into the script) — see | |
| # GitHub's workflow-injection guidance. | |
| # Headless via the full-chromium channel is the verified CI path (both | |
| # scenes + promo + recordVideo; artifact visually checked). Headed-under- | |
| # xvfb proved unreliable on runners (8-bit default breaks screenshot | |
| # capture; 24-bit attempt failed silently) and was removed. | |
| - name: Capture | |
| env: | |
| SCENE: ${{ inputs.scene }} | |
| VIDEO: ${{ inputs.video }} | |
| run: | | |
| ARGS=() | |
| if [ -n "$SCENE" ]; then ARGS+=(--scene "$SCENE"); fi | |
| if [ "$VIDEO" != "true" ]; then ARGS+=(--no-video); fi | |
| # No pipe around shotkit — the default GH shell lacks pipefail, and a | |
| # pipe would mask its exit code. Progress logs stream live on stderr. | |
| HEADED=0 npx shotkit --json "${ARGS[@]}" > shotkit-result.json | |
| cat shotkit-result.json | |
| { echo "### shotkit assets" | |
| node -e "const r=require('./shotkit-result.json'); console.log((r.produced||[]).map(p=>'- \`'+p.split('/').pop()+'\`').join('\n'))" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload assets | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: store-assets | |
| path: | | |
| store-assets/*.png | |
| store-assets/*.webm | |
| store-assets/description.md | |
| if-no-files-found: error |