Skip to content

Bump the npm_and_yarn group across 1 directory with 3 updates #491

Bump the npm_and_yarn group across 1 directory with 3 updates

Bump the npm_and_yarn group across 1 directory with 3 updates #491

name: Deploy Preview
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
workflow_dispatch:
permissions:
contents: read
deployments: write
issues: write
pull-requests: write
jobs:
deploy-preview:
name: Deploy Preview
runs-on: ubuntu-latest
environment: preview
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 }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
WEBMENTION_IO_TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }}
# Secrets are not available to forked PRs. Also, we don't want to deploy untrusted forks.
if: github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.fork == false
permissions:
contents: read
deployments: write
issues: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- 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: Skip preview deployment when Vercel token is unavailable
if: env.VERCEL_TOKEN == ''
run: |
echo "Skipping Vercel preview deployment because VERCEL_TOKEN is unavailable for this event."
echo "This is expected for Dependabot pull requests and other untrusted contexts where GitHub withholds secrets."
- name: Vercel build (preview)
if: env.VERCEL_TOKEN != ''
run: vercel build --token="${VERCEL_TOKEN}"
- name: Deploy to Vercel (preview)
if: env.VERCEL_TOKEN != ''
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: false
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: Preview