For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/getting-started.md.
  • English
  • Get Started

    This section explains the steps for actually using nexterias/actions-vercel to deploy to Vercel.

    Prerequisites

    • A GitHub account
    • A Vercel account
    • Vercel CLI

    Create a Repository and Vercel Project

    First, create a repository on GitHub.

    gh repo create --public --clone example-vercel-project
    cd ./example-vercel-project
    Info

    To create a private repository, remove the --public flag and add the --private flag.

    Next, create a project on Vercel.

    vercel link

    If the command completes successfully, a folder named .vercel should be created in the current directory, and project.json should be created inside it.

    The project.json file contains two properties, projectId and orgId. Record each value.

    # projectId
    cat ./vercel/project.json | jq -r '.projectId'
    
    # orgId
    cat ./vercel/project.json | jq -r '.orgId'

    Create a Vercel Access Token

    Go to Account Settings and create an access token.

    FieldDescription
    NAMEEnter any name
    SCOPESelect the team that has the Vercel project you created
    EXPIRATIONSet any value

    After filling in the fields above and clicking Create, you will receive an access token. Record its value.

    Register Secret Information

    1. Go to the repository page from github,com
    2. Click the Settings tab
    3. In the Security section, click Secrets and variables
    4. Click the Secrets tab

    Register the values above from New repository secret as follows.

    NameValue
    VERCEL_PROJECT_IDValue of projectId
    VERCEL_ORG_IDValue of orgId
    VERCEL_TOKEN Created access token

    Configure GitHub Actions

    Create a .github/workflows directory in your repository, then create a file named vercel.yml in it with the following contents.

    name: Vercel
    
    on:
      push:
        branches: [main]
      pull_request:
    
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
      cancel-in-progress: true
    
    jobs:
      deploy:
        name: Deploy
        runs-on: ubuntu-latest
        permissions:
          contents: read
          deployments: write
          statuses: write
          pull-requests: write
    
        steps:
          - uses: actions/checkout@v7
    
          - uses: nexterias/actions-vercel@v2
            with:
              token: ${{ secrets.VERCEL_TOKEN }}
              org-id: ${{ secrets.VERCEL_ORG_ID }}
              project-id: ${{ secrets.VERCEL_PROJECT_ID }}
              production: ${{ github.ref == 'refs/heads/main' }}
    

    You can now deploy to Vercel with GitHub Actions.

    Tip

    GITHUB_TOKEN Permissions Additional information about the items specified in jobs.*.permissions:

    PermissionDescription
    contentsRequired by actions/checkout
    deploymentsSet to write to create and update deployments
    statusesSet to write to create and update commit statuses
    pull-requestsSet to write to create comments on pull requests

    It also works when contents is set to only read, but the features that imitate Vercel's GitHub integration become unavailable.