To set up your CI/CD pipeline with GitHub actions in this boilerplate follow these steps:
Step 1: Set "deploymentEnabled" to false in the "vercel.json" file
Open the vercel.json
file in the root directory and set deploymentEnabled
to false
. This change disables automatic deployments triggered by Vercel on every commit.
{
"git": {
"deploymentEnabled": false
}
}
Step 2: Add your "VERCEL_TOKEN" to GitHub secrets
To deploy your app to Vercel, add your Vercel token to GitHub secrets. To do this, follow these steps:
Step 2.1: Create a Vercel token
-
Navigate to https://vercel.com/account/tokens.
-
Enter the
TOKEN NAME
,SCOPE
, andEXPIRATION
and click the blue "Create" button to create a new token. -
Copy the token and save it somewhere safe. You will need it in the next step.
Step 2.2: Add your Vercel token to GitHub secrets
- Navigate to the "Actions" section of the "Secrets and Variables" settings of your repository -
Repository name
>Settings
>Secrets and Variables
>Actions
-
Click the green "New repository secret" button.
-
Enter your secret name (e.g. VERCEL_TOKEN) and paste the secret value copied in the previous step.
-
Click the green "Add secret" button to save the secret.
Once these steps are done, every pull request to the main
or master
branch will be automatically deployed to Vercel through GitHub actions. Before the deployment, the unit tests and integration tests in the __test__
and e2e
directories will be run. If all the tests succeed, the app will be deployed to Vercel.