Skip to content

feat(e2e): add Playwright coverage, onboarding seed bridge, and CI #130

feat(e2e): add Playwright coverage, onboarding seed bridge, and CI

feat(e2e): add Playwright coverage, onboarding seed bridge, and CI #130

Workflow file for this run

name: Deploy to Vercel
on:
pull_request_target:
types:
- labeled
- reopened
- synchronize
branches:
- main
push:
branches:
- main
workflow_dispatch:
concurrency:
group: vercel-${{ github.event_name == 'pull_request_target' && format('pr-{0}', github.event.pull_request.number) || 'production' }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
jobs:
deploy:
name: Deploy
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request_target' &&
contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
runs-on: ubuntu-latest
environment:
name: ${{ github.event_name == 'pull_request_target' && 'test' || 'production' }}
url: ${{ github.event_name == 'pull_request_target' && steps.deploy_preview.outputs.url || steps.deploy_production.outputs.url }}
permissions:
contents: read
deployments: write
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Pull Vercel production environment
if: github.event_name != 'pull_request_target'
run: bunx vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Pull Vercel preview environment
if: github.event_name == 'pull_request_target'
run: bunx vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build production output
if: github.event_name != 'pull_request_target'
run: bunx vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Build preview output
if: github.event_name == 'pull_request_target'
run: bunx vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy prebuilt production output
id: deploy_production
if: github.event_name != 'pull_request_target'
run: |
deployment_output="$(bunx vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }})"
echo "$deployment_output"
deployment_url="$(echo "$deployment_output" | tail -n 1)"
echo "url=$deployment_url" >> "$GITHUB_OUTPUT"
- name: Deploy prebuilt preview output
id: deploy_preview
if: github.event_name == 'pull_request_target'
run: |
deployment_output="$(bunx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})"
echo "$deployment_output"
deployment_url="$(echo "$deployment_output" | tail -n 1)"
echo "url=$deployment_url" >> "$GITHUB_OUTPUT"