Skip to content

Vercel Preview Deployment #143

Vercel Preview Deployment

Vercel Preview Deployment #143

Workflow file for this run

name: Vercel Preview Deployment
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches: [main]
permissions:
contents: read
pull-requests: write
jobs:
deploy-preview:
name: Deploy Preview to Vercel
runs-on: ubuntu-latest
# Add manual approval requirement for external PRs
environment:
name: preview-deployment
steps:
- name: Check out code
uses: actions/checkout@v4
with:
# For pull_request_target, we need to checkout the PR branch
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-comment: true
alias-domains: |
shopstr-pr-${{ github.event.number }}.vercel.app