Skip to content

Commit 0118bdf

Browse files
author
codegen-bot
committed
CG-12227: Enable deployment of codegen PRs to Vercel
1 parent a204611 commit 0118bdf

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Vercel PR Deployment
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths:
7+
- 'docs/**'
8+
- 'vercel.json'
9+
- '.github/workflows/vercel-pr-deployment.yml'
10+
11+
jobs:
12+
deploy-preview:
13+
runs-on: ubuntu-latest
14+
environment: preview
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Deploy to Vercel
20+
uses: amondnet/vercel-action@v25
21+
with:
22+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
23+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
24+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
github-comment: true
27+
working-directory: ./

docs/VERCEL_DEPLOYMENT.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Vercel Deployment for Codegen Documentation
2+
3+
This document explains how to set up Vercel deployments for the Codegen documentation site.
4+
5+
## PR Deployments
6+
7+
The repository is configured to automatically deploy PR previews to Vercel when changes are made to the `docs/` directory.
8+
9+
### Setup Instructions
10+
11+
To enable PR deployments to Vercel, follow these steps:
12+
13+
1. **Create a Vercel Project**:
14+
- Go to [Vercel](https://vercel.com) and create a new project
15+
- Import the `codegen` repository
16+
- Configure the project with the following settings:
17+
- Framework Preset: Other
18+
- Build Command: `echo 'Mintlify docs deployment'`
19+
- Output Directory: `docs`
20+
21+
2. **Configure GitHub Secrets**:
22+
- In the GitHub repository settings, add the following secrets:
23+
- `VERCEL_TOKEN`: Your Vercel API token (create one in Vercel account settings)
24+
- `VERCEL_ORG_ID`: Your Vercel organization ID (found in Vercel project settings)
25+
- `VERCEL_PROJECT_ID`: Your Vercel project ID (found in Vercel project settings)
26+
27+
3. **Mintlify Integration**:
28+
- Ensure your Mintlify account is connected to the Vercel project
29+
- Mintlify will handle the actual documentation rendering
30+
31+
## How It Works
32+
33+
When a PR is opened or updated that includes changes to the `docs/` directory:
34+
35+
1. The GitHub workflow `.github/workflows/vercel-pr-deployment.yml` is triggered
36+
2. The workflow deploys the documentation to Vercel
37+
3. A comment is added to the PR with a link to the preview deployment
38+
4. You can view the documentation preview to verify changes before merging
39+
40+
## Production Deployment
41+
42+
The production deployment is handled separately and is triggered when changes are merged to the main branch.
43+
44+
## Troubleshooting
45+
46+
If you encounter issues with the Vercel deployment:
47+
48+
1. Check that all required secrets are properly configured
49+
2. Verify that the Vercel project settings match the configuration in `vercel.json`
50+
3. Ensure the Mintlify integration is properly set up
51+
4. Check the GitHub Actions logs for any error messages

vercel.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"buildCommand": "echo 'Mintlify docs deployment'",
3+
"outputDirectory": "docs",
4+
"framework": "other",
5+
"github": {
6+
"enabled": true,
7+
"silent": true
8+
}
9+
}

0 commit comments

Comments
 (0)