Capture store assets #3
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 | |
| headless: | |
| description: 'Run headless (verified on Linux CI incl. video); false = headed under xvfb' | |
| 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 xvfb (always) + Playwright Chromium (conditional) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb | |
| 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. | |
| - name: Capture | |
| env: | |
| SCENE: ${{ inputs.scene }} | |
| VIDEO: ${{ inputs.video }} | |
| HEADLESS: ${{ inputs.headless }} | |
| 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. | |
| if [ "$HEADLESS" = "true" ]; then | |
| HEADED=0 npx shotkit --json "${ARGS[@]}" > shotkit-result.json | |
| else | |
| # 24-bit depth is required — xvfb-run's default 8-bit screen makes | |
| # Chromium's Page.captureScreenshot fail ("Unable to capture screenshot"). | |
| xvfb-run -a --server-args="-screen 0 1920x1080x24" \ | |
| npx shotkit --json "${ARGS[@]}" > shotkit-result.json | |
| fi | |
| 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 |