2026-03-26 #89
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Vercel Production | |
| # This workflow deploys to Vercel production when a GitHub release is published, | |
| # or manually via workflow_dispatch (deploys latest main). | |
| # 1. Deploy both projects with --prod (builds with production env vars, may auto-promote) | |
| # 2. Wait for Vercel deployment checks to pass (configured in Vercel dashboard) | |
| # 3. Explicitly promote both to current production (tolerates already-promoted deployments) | |
| # | |
| # Required secrets (configure in GitHub Repository Settings > Secrets): | |
| # - VERCEL_TOKEN: API token from Vercel Dashboard > Settings > Tokens | |
| # - VERCEL_ORG_ID: Organization/team ID from .vercel/project.json after running `vercel link` | |
| # - VERCEL_API_PROJECT_ID: Project ID for agents-api | |
| # - VERCEL_MANAGE_UI_PROJECT_ID: Project ID for agents-manage-ui | |
| # - INKEEP_AGENTS_RUN_DATABASE_URL: Production Postgres connection string (runtime DB) | |
| # - INKEEP_AGENTS_MANAGE_DATABASE_URL: Production Doltgres connection string (manage DB) | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| jobs: | |
| migrate-databases: | |
| name: Migrate databases | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name || 'main' }} | |
| - name: Install | |
| uses: ./.github/composite-actions/install | |
| - name: Validate migration history | |
| run: pnpm db:check | |
| - name: Migrate runtime database (Postgres) | |
| run: pnpm db:run:migrate | |
| env: | |
| INKEEP_AGENTS_RUN_DATABASE_URL: ${{ secrets.INKEEP_AGENTS_RUN_DATABASE_URL }} | |
| - name: Migrate manage database (Doltgres) | |
| id: manage-migrate | |
| run: pnpm db:manage:migrate | |
| env: | |
| INKEEP_AGENTS_MANAGE_DATABASE_URL: ${{ secrets.INKEEP_AGENTS_MANAGE_DATABASE_URL }} | |
| - name: Sync Doltgres schema to all branches | |
| if: steps.manage-migrate.outputs.migrations_applied == 'true' | |
| run: pnpm --filter @inkeep/agents-core db:manage:sync-all-branches | |
| env: | |
| INKEEP_AGENTS_MANAGE_DATABASE_URL: ${{ secrets.INKEEP_AGENTS_MANAGE_DATABASE_URL }} | |
| deploy-agents-api: | |
| name: Deploy agents-api | |
| needs: [migrate-databases] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| url: ${{ steps.deploy.outputs.url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name || 'main' }} | |
| - name: Set Project ID | |
| run: echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_API_PROJECT_ID }}" >> $GITHUB_ENV | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Pull Vercel Environment | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy to Production | |
| id: deploy | |
| run: | | |
| DEPLOYMENT_URL=$(vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}) | |
| if [ -z "$DEPLOYMENT_URL" ]; then | |
| echo "Error: Failed to capture deployment URL" | |
| exit 1 | |
| fi | |
| echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT | |
| echo "Deployed to: $DEPLOYMENT_URL" | |
| - name: Wait for Deployment Checks | |
| run: | | |
| echo "Waiting for Vercel deployment checks to complete..." | |
| vercel inspect ${{ steps.deploy.outputs.url }} --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_ORG_ID }} --wait | |
| deploy-agents-manage-ui: | |
| name: Deploy agents-manage-ui | |
| needs: [migrate-databases] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| url: ${{ steps.deploy.outputs.url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| ref: ${{ github.event.release.tag_name || 'main' }} | |
| - name: Set Project ID | |
| run: echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_MANAGE_UI_PROJECT_ID }}" >> $GITHUB_ENV | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Pull Vercel Environment | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy to Production | |
| id: deploy | |
| run: | | |
| DEPLOYMENT_URL=$(vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}) | |
| if [ -z "$DEPLOYMENT_URL" ]; then | |
| echo "Error: Failed to capture deployment URL" | |
| exit 1 | |
| fi | |
| echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT | |
| echo "Deployed to: $DEPLOYMENT_URL" | |
| - name: Wait for Deployment Checks | |
| run: | | |
| echo "Waiting for Vercel deployment checks to complete..." | |
| vercel inspect ${{ steps.deploy.outputs.url }} --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_ORG_ID }} --wait | |
| promote: | |
| name: Promote all to production | |
| needs: [deploy-agents-api, deploy-agents-manage-ui] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Promote agents-api | |
| run: | | |
| echo "Promoting agents-api to production..." | |
| if ! OUTPUT=$(vercel promote ${{ needs.deploy-agents-api.outputs.url }} --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_ORG_ID }} 2>&1); then | |
| if echo "$OUTPUT" | grep -q "already the current production deployment"; then | |
| echo "::warning::agents-api deployment is already the current production deployment, skipping promote" | |
| else | |
| echo "$OUTPUT" | |
| exit 1 | |
| fi | |
| fi | |
| - name: Promote agents-manage-ui | |
| run: | | |
| echo "Promoting agents-manage-ui to production..." | |
| if ! OUTPUT=$(vercel promote ${{ needs.deploy-agents-manage-ui.outputs.url }} --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_ORG_ID }} 2>&1); then | |
| if echo "$OUTPUT" | grep -q "already the current production deployment"; then | |
| echo "::warning::agents-manage-ui deployment is already the current production deployment, skipping promote" | |
| else | |
| echo "$OUTPUT" | |
| exit 1 | |
| fi | |
| fi |