From 0118bdf5009d4fcd8319882098a8dba2793ceabb Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Mon, 17 Mar 2025 17:50:11 +0000 Subject: [PATCH 1/2] CG-12227: Enable deployment of codegen PRs to Vercel --- .github/workflows/vercel-pr-deployment.yml | 27 ++++++++++++ docs/VERCEL_DEPLOYMENT.md | 51 ++++++++++++++++++++++ vercel.json | 9 ++++ 3 files changed, 87 insertions(+) create mode 100644 .github/workflows/vercel-pr-deployment.yml create mode 100644 docs/VERCEL_DEPLOYMENT.md create mode 100644 vercel.json diff --git a/.github/workflows/vercel-pr-deployment.yml b/.github/workflows/vercel-pr-deployment.yml new file mode 100644 index 000000000..d8ba39f2b --- /dev/null +++ b/.github/workflows/vercel-pr-deployment.yml @@ -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: ./ \ No newline at end of file diff --git a/docs/VERCEL_DEPLOYMENT.md b/docs/VERCEL_DEPLOYMENT.md new file mode 100644 index 000000000..6c0c66789 --- /dev/null +++ b/docs/VERCEL_DEPLOYMENT.md @@ -0,0 +1,51 @@ +# 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` + +2. **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) + +3. **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 +2. The workflow deploys the documentation to Vercel +3. A comment is added to the PR with a link to the preview deployment +4. 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 +2. Verify that the Vercel project settings match the configuration in `vercel.json` +3. Ensure the Mintlify integration is properly set up +4. Check the GitHub Actions logs for any error messages \ No newline at end of file diff --git a/vercel.json b/vercel.json new file mode 100644 index 000000000..44ad50a59 --- /dev/null +++ b/vercel.json @@ -0,0 +1,9 @@ +{ + "buildCommand": "echo 'Mintlify docs deployment'", + "outputDirectory": "docs", + "framework": "other", + "github": { + "enabled": true, + "silent": true + } +} \ No newline at end of file From 289b2ed2b669f99a8cc5674e3bb7bd2c822ef6ea Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 17:50:57 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- .github/workflows/vercel-pr-deployment.yml | 2 +- docs/VERCEL_DEPLOYMENT.md | 19 +++++++++++-------- vercel.json | 16 ++++++++-------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/vercel-pr-deployment.yml b/.github/workflows/vercel-pr-deployment.yml index d8ba39f2b..fbf336ae7 100644 --- a/.github/workflows/vercel-pr-deployment.yml +++ b/.github/workflows/vercel-pr-deployment.yml @@ -24,4 +24,4 @@ jobs: vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} github-token: ${{ secrets.GITHUB_TOKEN }} github-comment: true - working-directory: ./ \ No newline at end of file + working-directory: ./ diff --git a/docs/VERCEL_DEPLOYMENT.md b/docs/VERCEL_DEPLOYMENT.md index 6c0c66789..0674793ca 100644 --- a/docs/VERCEL_DEPLOYMENT.md +++ b/docs/VERCEL_DEPLOYMENT.md @@ -11,6 +11,7 @@ The repository is configured to automatically deploy PR previews to Vercel when 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: @@ -18,13 +19,15 @@ To enable PR deployments to Vercel, follow these steps: - Build Command: `echo 'Mintlify docs deployment'` - Output Directory: `docs` -2. **Configure GitHub Secrets**: +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) -3. **Mintlify Integration**: +1. **Mintlify Integration**: + - Ensure your Mintlify account is connected to the Vercel project - Mintlify will handle the actual documentation rendering @@ -33,9 +36,9 @@ To enable PR deployments to Vercel, follow these steps: 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 -2. The workflow deploys the documentation to Vercel -3. A comment is added to the PR with a link to the preview deployment -4. You can view the documentation preview to verify changes before merging +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 @@ -46,6 +49,6 @@ The production deployment is handled separately and is triggered when changes ar If you encounter issues with the Vercel deployment: 1. Check that all required secrets are properly configured -2. Verify that the Vercel project settings match the configuration in `vercel.json` -3. Ensure the Mintlify integration is properly set up -4. Check the GitHub Actions logs for any error messages \ No newline at end of file +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 diff --git a/vercel.json b/vercel.json index 44ad50a59..7f90eb1be 100644 --- a/vercel.json +++ b/vercel.json @@ -1,9 +1,9 @@ { - "buildCommand": "echo 'Mintlify docs deployment'", - "outputDirectory": "docs", - "framework": "other", - "github": { - "enabled": true, - "silent": true - } -} \ No newline at end of file + "buildCommand": "echo 'Mintlify docs deployment'", + "outputDirectory": "docs", + "framework": "other", + "github": { + "enabled": true, + "silent": true + } +}