In the Vercel Web UI...
- Create a new project
- Ensure
- Build command is left empty with Override on
- Output directory is changed to dist (which is the default output directory for Trunk builds)
Both of these actions will need your Vercel credentials setup in GitHub secrets
-
Retrieve your Vercel Access Token by going to "Account Settings" > "Tokens" and creating a new token - save the token to use in sub-step 5, below.
-
Install the Vercel CLI using the
npm i -g vercel
command, then runvercel login
to login to your acccount. -
Inside your folder, run
vercel link
to create a new Vercel project; in the CLI, you will be asked to 'Link to an existing project?' - answer yes, then enter the name you created in step 1. A new.vercel
folder will be created for you. -
Inside the generated
.vercel
folder, open the theproject.json
file and save the "projectId" and "orgId" for the next step. -
Inside GitHub, go the repo's "Settings" > "Secrets and Variables" > "Actions" and add the following as Repository secrets:
- save your Vercel Access Token (from sub-step 1) as the
VERCEL_TOKEN
secret - from the
.vercel/project.json
add "projectID" asVERCEL_PROJECT_ID
- from the
.vercel/project.json
add "orgId" asVERCEL_ORG_ID
Instructions from https://vercel.com/guides/how-can-i-use-github-actions-with-vercel
Finally, you're ready to simply copy and paste the two files in .github/workflows/
into your own gh workflows folder - then, on your next commit or PR you can just sit back and watch the magic happen!