Web Staging Deploy #8
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: Web Staging Deploy | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| name: Deploy attn web staging | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: web | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install native test dependencies | |
| working-directory: . | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev xvfb | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| # web/ depends on wrangler 4.x, which requires Node >= 22; the deploy | |
| # step dies with "Wrangler requires at least Node.js v22.0.0" on 20. | |
| node-version: "22" | |
| cache: npm | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright Chromium | |
| run: npx playwright install --with-deps chromium | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: web-staging-e2e | |
| - name: Typecheck | |
| run: npm run check | |
| - name: Unit tests | |
| run: npm test | |
| - name: Build native frontend and owner | |
| working-directory: . | |
| env: | |
| ATTN_DEFAULT_RELAY_URL: https://relay-staging.attn.sh | |
| ATTN_DEFAULT_BROWSER_REVIEW_URL: https://staging.attn.sh/review | |
| run: | | |
| npm --prefix web run build | |
| cargo build --locked | |
| - name: Build, verify, and deploy hosted app | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: | | |
| if [ -z "$CLOUDFLARE_API_TOKEN" ] || [ -z "$CLOUDFLARE_ACCOUNT_ID" ]; then | |
| echo "::error::Cloudflare deployment credentials are not set." | |
| exit 1 | |
| fi | |
| npm run deploy:staging | |
| - name: Verify native-browser parity on staging | |
| working-directory: . | |
| run: | | |
| xvfb-run -a env \ | |
| E2E_RELAY_URL=https://relay-staging.attn.sh \ | |
| E2E_WEB_ORIGIN=https://staging.attn.sh \ | |
| scripts/test-hosted-review-e2e.sh |