Skip to content

Merge pull request #702 from webstackdev/bugfix/fix-sentry-error-with… #140

Merge pull request #702 from webstackdev/bugfix/fix-sentry-error-with…

Merge pull request #702 from webstackdev/bugfix/fix-sentry-error-with… #140

name: Deploy Production
on:
push:
branches:
- main
workflow_dispatch:
permissions:
actions: read
contents: read
deployments: write
issues: write
pull-requests: write
jobs:
deploy-production:
name: Deploy Production
runs-on: ubuntu-latest
environment: production
env:
ASTRO_DB_APP_TOKEN: ${{ secrets.ASTRO_DB_APP_TOKEN }}
ASTRO_DB_REMOTE_URL: ${{ secrets.ASTRO_DB_REMOTE_URL }}
CRON_SECRET: ${{ secrets.CRON_SECRET }}
PUBLIC_GOOGLE_MAPS_API_KEY: ${{ vars.PUBLIC_GOOGLE_MAPS_API_KEY }}
PUBLIC_GOOGLE_MAP_ID: ${{ vars.PUBLIC_GOOGLE_MAP_ID }}
PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN: ${{ vars.PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN }}
PUBLIC_UPSTASH_SEARCH_REST_URL: ${{ vars.PUBLIC_UPSTASH_SEARCH_REST_URL }}
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
WEBMENTION_IO_TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }}
permissions:
actions: read
contents: read
deployments: write
issues: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright Chromium (with system deps)
run: npx playwright install --with-deps chromium
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Create Vercel project config
run: |
mkdir -p .vercel
cat > .vercel/project.json <<EOF
{"projectId":"$VERCEL_PROJECT_ID","orgId":"$VERCEL_ORG_ID","settings":{"framework":"astro","installCommand":"npm ci"}}
EOF
- name: Vercel build (production)
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
NODE_ENV: production
run: vercel build --prod --token="${VERCEL_TOKEN}"
##
# This requires Playwright to succeed when triggering e2e tests from a merge_group
# event. This allows moving long-running jobs into a slot in the total workflow where
# they don't run on every push to a pull request, but are still required to deploy
# to production and merge to main. Merge groups are only available in organization
# repos so disabled for now.
##
#- name: Require Playwright success
# if: github.event_name == 'push'
# uses: ./.github/actions/require-playwright-success
# with:
# github_token: ${{ github.token }}
# expected_sha: ${{ github.sha }}
# workflow_file: playwright.yml
- name: Deploy to Vercel (production)
uses: ./.github/actions/deploy-to-vercel-action
with:
GITHUB_TOKEN: ${{ github.token }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
PRODUCTION: true
PUBLIC_GOOGLE_MAPS_API_KEY: ${{ vars.PUBLIC_GOOGLE_MAPS_API_KEY }}
PUBLIC_GOOGLE_MAP_ID: ${{ vars.PUBLIC_GOOGLE_MAP_ID }}
PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }}
PUBLIC_UPSTASH_SEARCH_REST_URL: ${{ vars.PUBLIC_UPSTASH_SEARCH_REST_URL }}
PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN: ${{ vars.PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN }}
GITHUB_DEPLOYMENT_ENV: Production