Skip to content

Docs SPA migration, portal theming, onboarding, nav toolbars, and backend hardening #63

Docs SPA migration, portal theming, onboarding, nav toolbars, and backend hardening

Docs SPA migration, portal theming, onboarding, nav toolbars, and backend hardening #63

Workflow file for this run

name: Preview
on:
pull_request:
types: [opened, synchronize, reopened, closed]
concurrency:
group: preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
deploy-preview:
name: Deploy preview
if: github.event.action != 'closed'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
env:
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}
CONVEX_PREVIEW_NAME: pr-${{ github.event.pull_request.number }}
AMEND_AUTH_ALLOWED_EMAILS: ${{ secrets.AMEND_PREVIEW_ALLOWED_EMAILS }}
AMEND_PREVIEW_AUTH_ENABLED: "true"
AMEND_PREVIEW_SEEDING_ENABLED: "true"
BETTER_AUTH_SECRET: ${{ secrets.AMEND_PREVIEW_BETTER_AUTH_SECRET }}
VITE_AMEND_PREVIEW_AUTH: "true"
POSTHOG_CLI_API_KEY: ${{ secrets.POSTHOG_CLI_API_KEY }}
POSTHOG_CLI_HOST: https://us.posthog.com
POSTHOG_CLI_PROJECT_ID: "441195"
POSTHOG_RELEASE_NAME: amend-web
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.5
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run check-types
- name: Deploy Convex preview and build web
run: |
bun --cwd packages/backend convex deploy \
--preview-create "$CONVEX_PREVIEW_NAME" \
--preview-run amend:seedDemoData \
--cmd-url-env-var-name VITE_CONVEX_URL \
--cmd 'cd ../.. && bun scripts/vercel-preview-build.ts'
bun --cwd packages/backend convex deploy \
--preview-name "$CONVEX_PREVIEW_NAME" \
--typecheck disable \
--codegen disable
AMEND_PREVIEW_ENV_SYNC_PHASE=bootstrap bun scripts/sync-convex-preview-env.ts
bun scripts/assert-convex-preview-http.ts
- name: Deploy Vercel preview
run: |
DEPLOYMENT_URL="$(bunx vercel deploy \
--prebuilt \
--yes \
--token "$VERCEL_TOKEN" \
--meta amendPreviewName="$CONVEX_PREVIEW_NAME" \
--meta githubPullRequest="${{ github.event.pull_request.number }}" \
--meta githubCommitSha="${{ github.sha }}" | tail -n 1)"
echo "Vercel preview: $DEPLOYMENT_URL"
DEPLOYMENT_URL="$DEPLOYMENT_URL" bun scripts/sync-convex-preview-env.ts
cleanup-preview:
name: Cleanup preview
if: github.event.action == 'closed'
runs-on: ubuntu-latest
permissions:
contents: read
env:
CONVEX_MANAGEMENT_TOKEN: ${{ secrets.CONVEX_MANAGEMENT_TOKEN }}
CONVEX_PROJECT_ID: ${{ secrets.CONVEX_PROJECT_ID }}
CONVEX_PREVIEW_NAME: pr-${{ github.event.pull_request.number }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.5
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Delete Convex preview
run: bun scripts/delete-convex-preview.ts
- name: Delete Vercel preview deployments
run: bun scripts/delete-vercel-preview.ts