Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/vercel-pr-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Vercel PR Deployment

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'docs/**'
- 'vercel.json'
- '.github/workflows/vercel-pr-deployment.yml'

jobs:
deploy-preview:
runs-on: ubuntu-latest
environment: preview
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-comment: true
working-directory: ./
54 changes: 54 additions & 0 deletions docs/VERCEL_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Vercel Deployment for Codegen Documentation

This document explains how to set up Vercel deployments for the Codegen documentation site.

## PR Deployments

The repository is configured to automatically deploy PR previews to Vercel when changes are made to the `docs/` directory.

### Setup Instructions

To enable PR deployments to Vercel, follow these steps:

1. **Create a Vercel Project**:

- Go to [Vercel](https://vercel.com) and create a new project
- Import the `codegen` repository
- Configure the project with the following settings:
- Framework Preset: Other
- Build Command: `echo 'Mintlify docs deployment'`
- Output Directory: `docs`

1. **Configure GitHub Secrets**:

- In the GitHub repository settings, add the following secrets:
- `VERCEL_TOKEN`: Your Vercel API token (create one in Vercel account settings)
- `VERCEL_ORG_ID`: Your Vercel organization ID (found in Vercel project settings)
- `VERCEL_PROJECT_ID`: Your Vercel project ID (found in Vercel project settings)

1. **Mintlify Integration**:

- Ensure your Mintlify account is connected to the Vercel project
- Mintlify will handle the actual documentation rendering

## How It Works

When a PR is opened or updated that includes changes to the `docs/` directory:

1. The GitHub workflow `.github/workflows/vercel-pr-deployment.yml` is triggered
1. The workflow deploys the documentation to Vercel
1. A comment is added to the PR with a link to the preview deployment
1. You can view the documentation preview to verify changes before merging

## Production Deployment

The production deployment is handled separately and is triggered when changes are merged to the main branch.

## Troubleshooting

If you encounter issues with the Vercel deployment:

1. Check that all required secrets are properly configured
1. Verify that the Vercel project settings match the configuration in `vercel.json`
1. Ensure the Mintlify integration is properly set up
1. Check the GitHub Actions logs for any error messages
9 changes: 9 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"buildCommand": "echo 'Mintlify docs deployment'",
"outputDirectory": "docs",
"framework": "other",
"github": {
"enabled": true,
"silent": true
}
}