[pull] main from tldraw:main #648
This file contains 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: Deploy .com | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- production | |
env: | |
CI: 1 | |
PRINT_GITHUB_ANNOTATIONS: 1 | |
TLDRAW_ENV: ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
deploy: | |
name: Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest-16-cores-open | |
environment: ${{ github.ref == 'refs/heads/production' && 'deploy-production' || 'deploy-staging' }} | |
concurrency: dotcom-${{ github.ref == 'refs/heads/production' && 'deploy-production' || github.ref }} | |
steps: | |
# - name: Notify initial start | |
# uses: MineBartekSA/discord-webhook@v2 | |
# if: github.ref == 'refs/heads/production' | |
# with: | |
# webhook: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }} | |
# content: 'Preparing ${{ env.TLDRAW_ENV }} dotcom deploy: ${{ github.event.head_commit.message }} by ${{ github.event.head_commit.author.name }}' | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/setup | |
- name: Delete Neon Branch | |
uses: neondatabase/[email protected] | |
if: contains(github.event.pull_request.labels.*.name, 'reset-preview-db') | |
with: | |
project_id: ${{ vars.NEON_PROJECT_ID }} | |
branch: pr-${{ github.event.number }} | |
api_key: ${{ secrets.NEON_API_KEY }} | |
- id: create-branch | |
# only run on PR branches | |
if: github.event_name == 'pull_request' | |
uses: neondatabase/create-branch-action@v5 | |
with: | |
project_id: ${{ vars.NEON_PROJECT_ID }} | |
username: 'dotcom_owner' | |
database: 'dotcom' | |
branch_name: pr-${{ github.event.number }} | |
api_key: ${{ secrets.NEON_API_KEY }} # Generate an API key in your Neon account settings | |
- run: | | |
echo "NEON_PREVIEW_DB_CONNECTION_STRING=${{ steps.create-branch.outputs.db_url }}" >> "$GITHUB_ENV" | |
echo "NEON_PREVIEW_DB_POOLED_CONNECTION_STRING=${{ steps.create-branch.outputs.db_url_with_pooler }}" >> "$GITHUB_ENV" | |
if: github.event_name == 'pull_request' | |
- name: Build types | |
run: yarn build-types | |
- name: Deploy | |
run: yarn tsx internal/scripts/deploy-dotcom.ts | |
env: | |
RELEASE_COMMIT_HASH: ${{ github.sha }} | |
GH_TOKEN: ${{ github.token }} | |
APP_ORIGIN: ${{ vars.APP_ORIGIN }} | |
ASSET_UPLOAD: ${{ vars.ASSET_UPLOAD }} | |
IMAGE_WORKER: ${{ vars.IMAGE_WORKER }} | |
MULTIPLAYER_SERVER: ${{ vars.MULTIPLAYER_SERVER }} | |
NEXT_PUBLIC_GOOGLE_CLOUD_PROJECT_NUMBER: ${{ vars.NEXT_PUBLIC_GOOGLE_CLOUD_PROJECT_NUMBER }} | |
SUPABASE_LITE_URL: ${{ vars.SUPABASE_LITE_URL }} | |
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ vars.VERCEL_DOTCOM_PROJECT_ID }} | |
ASSET_UPLOAD_SENTRY_DSN: ${{ secrets.ASSET_UPLOAD_SENTRY_DSN }} | |
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }} | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
DISCORD_DEPLOY_WEBHOOK_URL: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }} | |
DISCORD_HEALTH_WEBHOOK_URL: ${{ secrets.DISCORD_HEALTH_WEBHOOK_URL }} | |
GC_MAPS_API_KEY: ${{ secrets.GC_MAPS_API_KEY }} | |
HEALTH_WORKER_UPDOWN_WEBHOOK_PATH: ${{ secrets.HEALTH_WORKER_UPDOWN_WEBHOOK_PATH }} | |
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
R2_ACCESS_KEY_SECRET: ${{ secrets.R2_ACCESS_KEY_SECRET }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_CSP_REPORT_URI: ${{ secrets.SENTRY_CSP_REPORT_URI }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SUPABASE_LITE_ANON_KEY: ${{ secrets.SUPABASE_LITE_ANON_KEY }} | |
TLDRAW_LICENSE: ${{ secrets.TLDRAW_LICENSE }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} | |
WORKER_SENTRY_DSN: ${{ secrets.WORKER_SENTRY_DSN }} | |
BOTCOM_POSTGRES_CONNECTION_STRING: ${{ secrets.BOTCOM_POSTGRES_CONNECTION_STRING }} | |
BOTCOM_POSTGRES_POOLED_CONNECTION_STRING: ${{ secrets.BOTCOM_POSTGRES_POOLED_CONNECTION_STRING }} |