.github/workflows/__deploy-vercel.yml
name: 'Deploy to Vercel'
on:
workflow_call:
inputs:
name:
description: >
GitHub environment name
type: string
required: true
production:
description: Deploy production?
type: boolean
required: false
default: false
secrets:
VERCEL_ORG_ID:
description: 'The Vercel ORG ID'
required: true
VERCEL_PROJECT_ID:
description: 'The Vercel Project Id'
required: true
VERCEL_TOKEN:
description: 'The Vercel API token'
required: true
concurrency:
group: deploy-vercel--${{ github.workflow }}-${{ github.ref }}--${{ inputs.name }}
permissions:
contents: read
deployments: write
pull-requests: write
jobs:
deploy:
name: Deploy ${{ inputs.name }} to Vercel (Production = ${{ inputs.production }})
runs-on: ubuntu-latest
environment:
name: ${{ inputs.name }}
url: ${{ steps.vercel.outputs.PREVIEW_URL }}
steps:
- name: Check out repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
with:
fetch-depth: 0
- name: Deploy to Vercel
id: vercel
uses: BetaHuhn/deploy-to-vercel-action@0f16bc3af7db7d5171bf68bff6f82679de195113 # v1
with:
GITHUB_DEPLOYMENT_ENV: ${{ inputs.name }}
GITHUB_DEPLOYMENT: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_LABELS: vercel
PRODUCTION: ${{ inputs.production }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}