Restore viz preview workflow #20
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: Preview viz | |
| on: | |
| push: | |
| branches: | |
| - claude/tuftean-marginalia-viz-TB0fw | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: preview-viz | |
| cancel-in-progress: true | |
| jobs: | |
| upload-preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: false | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: uv sync --all-groups | |
| - name: Build generated assets | |
| run: make build | |
| - name: Verify Cloudflare auth | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: npx --yes wrangler whoami | |
| - name: Sync Python Workers vendor | |
| run: uv run pywrangler sync | |
| - name: Upload Cloudflare Preview | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: | | |
| set -x | |
| uv run pywrangler preview \ | |
| --name viz \ | |
| --message "${{ github.sha }}" \ | |
| --json | |
| - name: Dump wrangler logs on failure | |
| if: failure() | |
| run: | | |
| find ~ /tmp /root -name "*.log" -path "*wrangler*" 2>/dev/null | while read f; do | |
| echo "=== $f ===" | |
| tail -300 "$f" || true | |
| done |