@intentsolutionsio/vercel-pack 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +67 -44
- package/package.json +4 -4
- package/skills/vercel-advanced-troubleshooting/SKILL.md +185 -195
- package/skills/vercel-advanced-troubleshooting/references/errors.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
- package/skills/vercel-advanced-troubleshooting/references/examples.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/systematic-isolation.md +56 -0
- package/skills/vercel-advanced-troubleshooting/references/timing-analysis.md +35 -0
- package/skills/vercel-architecture-variants/SKILL.md +227 -216
- package/skills/vercel-architecture-variants/references/errors.md +11 -0
- package/skills/vercel-architecture-variants/references/examples.md +12 -0
- package/skills/vercel-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
- package/skills/vercel-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
- package/skills/vercel-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
- package/skills/vercel-ci-integration/SKILL.md +183 -73
- package/skills/vercel-ci-integration/references/errors.md +10 -0
- package/skills/vercel-ci-integration/references/examples.md +36 -0
- package/skills/vercel-ci-integration/references/implementation.md +54 -0
- package/skills/vercel-common-errors/SKILL.md +164 -60
- package/skills/vercel-common-errors/references/errors.md +53 -0
- package/skills/vercel-common-errors/references/examples.md +23 -0
- package/skills/vercel-cost-tuning/SKILL.md +158 -145
- package/skills/vercel-cost-tuning/references/cost-estimation.md +34 -0
- package/skills/vercel-cost-tuning/references/cost-reduction-strategies.md +40 -0
- package/skills/vercel-cost-tuning/references/errors.md +11 -0
- package/skills/vercel-cost-tuning/references/examples.md +15 -0
- package/skills/vercel-data-handling/SKILL.md +202 -155
- package/skills/vercel-data-handling/references/errors.md +11 -0
- package/skills/vercel-data-handling/references/examples.md +27 -0
- package/skills/vercel-data-handling/references/implementation.md +223 -0
- package/skills/vercel-debug-bundle/SKILL.md +163 -67
- package/skills/vercel-debug-bundle/references/errors.md +12 -0
- package/skills/vercel-debug-bundle/references/examples.md +24 -0
- package/skills/vercel-debug-bundle/references/implementation.md +54 -0
- package/skills/vercel-deploy-integration/SKILL.md +163 -156
- package/skills/vercel-deploy-integration/references/errors.md +11 -0
- package/skills/vercel-deploy-integration/references/examples.md +21 -0
- package/skills/vercel-deploy-integration/references/google-cloud-run.md +36 -0
- package/skills/vercel-deploy-integration/references/vercel-deployment.md +35 -0
- package/skills/vercel-deploy-preview/SKILL.md +164 -39
- package/skills/vercel-edge-functions/SKILL.md +185 -37
- package/skills/vercel-enterprise-rbac/SKILL.md +185 -170
- package/skills/vercel-enterprise-rbac/references/errors.md +11 -0
- package/skills/vercel-enterprise-rbac/references/examples.md +12 -0
- package/skills/vercel-enterprise-rbac/references/role-implementation.md +33 -0
- package/skills/vercel-enterprise-rbac/references/sso-integration.md +35 -0
- package/skills/vercel-hello-world/SKILL.md +141 -55
- package/skills/vercel-incident-runbook/SKILL.md +186 -138
- package/skills/vercel-incident-runbook/references/errors.md +11 -0
- package/skills/vercel-incident-runbook/references/examples.md +10 -0
- package/skills/vercel-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
- package/skills/vercel-install-auth/SKILL.md +130 -53
- package/skills/vercel-known-pitfalls/SKILL.md +235 -233
- package/skills/vercel-known-pitfalls/references/errors.md +11 -0
- package/skills/vercel-known-pitfalls/references/examples.md +12 -0
- package/skills/vercel-load-scale/SKILL.md +197 -204
- package/skills/vercel-load-scale/references/capacity-planning.md +47 -0
- package/skills/vercel-load-scale/references/errors.md +11 -0
- package/skills/vercel-load-scale/references/examples.md +26 -0
- package/skills/vercel-load-scale/references/load-testing-with-k6.md +59 -0
- package/skills/vercel-load-scale/references/scaling-patterns.md +65 -0
- package/skills/vercel-local-dev-loop/SKILL.md +159 -71
- package/skills/vercel-local-dev-loop/references/errors.md +11 -0
- package/skills/vercel-local-dev-loop/references/examples.md +21 -0
- package/skills/vercel-local-dev-loop/references/implementation.md +60 -0
- package/skills/vercel-migration-deep-dive/SKILL.md +202 -187
- package/skills/vercel-migration-deep-dive/references/errors.md +11 -0
- package/skills/vercel-migration-deep-dive/references/examples.md +12 -0
- package/skills/vercel-migration-deep-dive/references/implementation-plan.md +80 -0
- package/skills/vercel-migration-deep-dive/references/pre-migration-assessment.md +39 -0
- package/skills/vercel-multi-env-setup/SKILL.md +167 -164
- package/skills/vercel-multi-env-setup/references/configuration-structure.md +59 -0
- package/skills/vercel-multi-env-setup/references/errors.md +11 -0
- package/skills/vercel-multi-env-setup/references/examples.md +11 -0
- package/skills/vercel-observability/SKILL.md +205 -195
- package/skills/vercel-observability/references/alert-configuration.md +40 -0
- package/skills/vercel-observability/references/errors.md +11 -0
- package/skills/vercel-observability/references/examples.md +13 -0
- package/skills/vercel-observability/references/metrics-collection.md +65 -0
- package/skills/vercel-performance-tuning/SKILL.md +212 -156
- package/skills/vercel-performance-tuning/references/caching-strategy.md +49 -0
- package/skills/vercel-performance-tuning/references/errors.md +11 -0
- package/skills/vercel-performance-tuning/references/examples.md +13 -0
- package/skills/vercel-policy-guardrails/SKILL.md +276 -193
- package/skills/vercel-policy-guardrails/references/errors.md +11 -0
- package/skills/vercel-policy-guardrails/references/eslint-rules.md +46 -0
- package/skills/vercel-policy-guardrails/references/examples.md +10 -0
- package/skills/vercel-prod-checklist/SKILL.md +219 -94
- package/skills/vercel-prod-checklist/references/errors.md +11 -0
- package/skills/vercel-prod-checklist/references/examples.md +25 -0
- package/skills/vercel-prod-checklist/references/implementation.md +60 -0
- package/skills/vercel-rate-limits/SKILL.md +187 -100
- package/skills/vercel-rate-limits/references/errors.md +11 -0
- package/skills/vercel-rate-limits/references/examples.md +46 -0
- package/skills/vercel-rate-limits/references/implementation.md +66 -0
- package/skills/vercel-reference-architecture/SKILL.md +226 -180
- package/skills/vercel-reference-architecture/references/errors.md +11 -0
- package/skills/vercel-reference-architecture/references/examples.md +13 -0
- package/skills/vercel-reference-architecture/references/key-components.md +65 -0
- package/skills/vercel-reference-architecture/references/project-structure.md +40 -0
- package/skills/vercel-reliability-patterns/SKILL.md +272 -211
- package/skills/vercel-reliability-patterns/references/circuit-breaker.md +36 -0
- package/skills/vercel-reliability-patterns/references/dead-letter-queue.md +48 -0
- package/skills/vercel-reliability-patterns/references/errors.md +11 -0
- package/skills/vercel-reliability-patterns/references/examples.md +11 -0
- package/skills/vercel-reliability-patterns/references/idempotency-keys.md +36 -0
- package/skills/vercel-sdk-patterns/SKILL.md +264 -92
- package/skills/vercel-sdk-patterns/references/errors.md +11 -0
- package/skills/vercel-sdk-patterns/references/examples.md +45 -0
- package/skills/vercel-sdk-patterns/references/implementation.md +67 -0
- package/skills/vercel-security-basics/SKILL.md +186 -96
- package/skills/vercel-security-basics/references/errors.md +10 -0
- package/skills/vercel-security-basics/references/examples.md +70 -0
- package/skills/vercel-security-basics/references/implementation.md +39 -0
- package/skills/vercel-upgrade-migration/SKILL.md +167 -67
- package/skills/vercel-upgrade-migration/references/errors.md +10 -0
- package/skills/vercel-upgrade-migration/references/examples.md +51 -0
- package/skills/vercel-upgrade-migration/references/implementation.md +29 -0
- package/skills/vercel-webhooks-events/SKILL.md +208 -132
- package/skills/vercel-webhooks-events/references/errors.md +11 -0
- package/skills/vercel-webhooks-events/references/event-handler-pattern.md +37 -0
- package/skills/vercel-webhooks-events/references/examples.md +16 -0
- package/skills/vercel-webhooks-events/references/signature-verification.md +33 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Variant A: Monolith (Simple)
|
|
2
|
+
|
|
3
|
+
## Variant A: Monolith (Simple)
|
|
4
|
+
|
|
5
|
+
**Best for:** MVPs, small teams, < 10K daily active users
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
my-app/
|
|
9
|
+
├── src/
|
|
10
|
+
│ ├── vercel/
|
|
11
|
+
│ │ ├── client.ts # Singleton client
|
|
12
|
+
│ │ ├── types.ts # Types
|
|
13
|
+
│ │ └── middleware.ts # Express middleware
|
|
14
|
+
│ ├── routes/
|
|
15
|
+
│ │ └── api/
|
|
16
|
+
│ │ └── vercel.ts # API routes
|
|
17
|
+
│ └── index.ts
|
|
18
|
+
├── tests/
|
|
19
|
+
│ └── vercel.test.ts
|
|
20
|
+
└── package.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Key Characteristics
|
|
24
|
+
|
|
25
|
+
- Single deployment unit
|
|
26
|
+
- Synchronous Vercel calls in request path
|
|
27
|
+
- In-memory caching
|
|
28
|
+
- Simple error handling
|
|
29
|
+
|
|
30
|
+
### Code Pattern
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// Direct integration in route handler
|
|
34
|
+
app.post('/api/create', async (req, res) => {
|
|
35
|
+
try {
|
|
36
|
+
const result = await vercelClient.create(req.body);
|
|
37
|
+
res.json(result);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
res.status(500).json({ error: error.message });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Variant B: Service Layer (Moderate)
|
|
2
|
+
|
|
3
|
+
## Variant B: Service Layer (Moderate)
|
|
4
|
+
|
|
5
|
+
**Best for:** Growing startups, 10K-100K DAU, multiple integrations
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
my-app/
|
|
9
|
+
├── src/
|
|
10
|
+
│ ├── services/
|
|
11
|
+
│ │ ├── vercel/
|
|
12
|
+
│ │ │ ├── client.ts # Client wrapper
|
|
13
|
+
│ │ │ ├── service.ts # Business logic
|
|
14
|
+
│ │ │ ├── repository.ts # Data access
|
|
15
|
+
│ │ │ └── types.ts
|
|
16
|
+
│ │ └── index.ts # Service exports
|
|
17
|
+
│ ├── controllers/
|
|
18
|
+
│ │ └── vercel.ts
|
|
19
|
+
│ ├── routes/
|
|
20
|
+
│ ├── middleware/
|
|
21
|
+
│ ├── queue/
|
|
22
|
+
│ │ └── vercel-processor.ts # Async processing
|
|
23
|
+
│ └── index.ts
|
|
24
|
+
├── config/
|
|
25
|
+
│ └── vercel/
|
|
26
|
+
└── package.json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Key Characteristics
|
|
30
|
+
|
|
31
|
+
- Separation of concerns
|
|
32
|
+
- Background job processing
|
|
33
|
+
- Redis caching
|
|
34
|
+
- Circuit breaker pattern
|
|
35
|
+
- Structured error handling
|
|
36
|
+
|
|
37
|
+
### Code Pattern
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// Service layer abstraction
|
|
41
|
+
class VercelService {
|
|
42
|
+
constructor(
|
|
43
|
+
private client: VercelClient,
|
|
44
|
+
private cache: CacheService,
|
|
45
|
+
private queue: QueueService
|
|
46
|
+
) {}
|
|
47
|
+
|
|
48
|
+
async createResource(data: CreateInput): Promise<Resource> {
|
|
49
|
+
// Business logic before API call
|
|
50
|
+
const validated = this.validate(data);
|
|
51
|
+
|
|
52
|
+
// Check cache
|
|
53
|
+
const cached = await this.cache.get(cacheKey);
|
|
54
|
+
if (cached) return cached;
|
|
55
|
+
|
|
56
|
+
// API call with retry
|
|
57
|
+
const result = await this.withRetry(() =>
|
|
58
|
+
this.client.create(validated)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Cache result
|
|
62
|
+
await this.cache.set(cacheKey, result, 300);
|
|
63
|
+
|
|
64
|
+
// Async follow-up
|
|
65
|
+
await this.queue.enqueue('vercel.post-create', result);
|
|
66
|
+
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Variant C: Microservice (Complex)
|
|
2
|
+
|
|
3
|
+
## Variant C: Microservice (Complex)
|
|
4
|
+
|
|
5
|
+
**Best for:** Enterprise, 100K+ DAU, strict SLAs
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
vercel-service/ # Dedicated microservice
|
|
9
|
+
├── src/
|
|
10
|
+
│ ├── api/
|
|
11
|
+
│ │ ├── grpc/
|
|
12
|
+
│ │ │ └── vercel.proto
|
|
13
|
+
│ │ └── rest/
|
|
14
|
+
│ │ └── routes.ts
|
|
15
|
+
│ ├── domain/
|
|
16
|
+
│ │ ├── entities/
|
|
17
|
+
│ │ ├── events/
|
|
18
|
+
│ │ └── services/
|
|
19
|
+
│ ├── infrastructure/
|
|
20
|
+
│ │ ├── vercel/
|
|
21
|
+
│ │ │ ├── client.ts
|
|
22
|
+
│ │ │ ├── mapper.ts
|
|
23
|
+
│ │ │ └── circuit-breaker.ts
|
|
24
|
+
│ │ ├── cache/
|
|
25
|
+
│ │ ├── queue/
|
|
26
|
+
│ │ └── database/
|
|
27
|
+
│ └── index.ts
|
|
28
|
+
├── config/
|
|
29
|
+
├── k8s/
|
|
30
|
+
│ ├── deployment.yaml
|
|
31
|
+
│ ├── service.yaml
|
|
32
|
+
│ └── hpa.yaml
|
|
33
|
+
└── package.json
|
|
34
|
+
|
|
35
|
+
other-services/
|
|
36
|
+
├── order-service/ # Calls vercel-service
|
|
37
|
+
├── payment-service/
|
|
38
|
+
└── notification-service/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Key Characteristics
|
|
42
|
+
|
|
43
|
+
- Dedicated Vercel microservice
|
|
44
|
+
- gRPC for internal communication
|
|
45
|
+
- Event-driven architecture
|
|
46
|
+
- Database per service
|
|
47
|
+
- Kubernetes autoscaling
|
|
48
|
+
- Distributed tracing
|
|
49
|
+
- Circuit breaker per service
|
|
50
|
+
|
|
51
|
+
### Code Pattern
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// Event-driven with domain isolation
|
|
55
|
+
class VercelAggregate {
|
|
56
|
+
private events: DomainEvent[] = [];
|
|
57
|
+
|
|
58
|
+
process(command: VercelCommand): void {
|
|
59
|
+
// Domain logic
|
|
60
|
+
const result = this.execute(command);
|
|
61
|
+
|
|
62
|
+
// Emit domain event
|
|
63
|
+
this.events.push(new VercelProcessedEvent(result));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getUncommittedEvents(): DomainEvent[] {
|
|
67
|
+
return [...this.events];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Event handler
|
|
72
|
+
@EventHandler(VercelProcessedEvent)
|
|
73
|
+
class VercelEventHandler {
|
|
74
|
+
async handle(event: VercelProcessedEvent): Promise<void> {
|
|
75
|
+
// Saga orchestration
|
|
76
|
+
await this.sagaOrchestrator.continue(event);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
@@ -1,124 +1,234 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vercel-ci-integration
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
description: 'Configure Vercel CI/CD with GitHub Actions, preview deployments, and
|
|
4
|
+
automated testing.
|
|
5
|
+
|
|
6
|
+
Use when setting up automated deployments, configuring preview bots,
|
|
7
|
+
|
|
8
|
+
or integrating Vercel into your CI pipeline.
|
|
9
|
+
|
|
7
10
|
Trigger with phrases like "vercel CI", "vercel GitHub Actions",
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
"vercel automated deploy", "CI vercel", "vercel pipeline".
|
|
13
|
+
|
|
14
|
+
'
|
|
15
|
+
allowed-tools: Read, Write, Edit, Bash(gh:*), Bash(vercel:*)
|
|
10
16
|
version: 1.0.0
|
|
11
17
|
license: MIT
|
|
12
18
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
19
|
+
tags:
|
|
20
|
+
- saas
|
|
21
|
+
- vercel
|
|
22
|
+
- ci-cd
|
|
23
|
+
- github-actions
|
|
24
|
+
- automation
|
|
25
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
13
26
|
---
|
|
14
|
-
|
|
15
27
|
# Vercel CI Integration
|
|
16
28
|
|
|
17
29
|
## Overview
|
|
18
|
-
|
|
30
|
+
|
|
31
|
+
Set up automated Vercel deployments in GitHub Actions with preview deployments on PRs, production deploys on merge to main, and optional test gating. Covers both Vercel's built-in Git integration and custom CI pipelines using the Vercel CLI.
|
|
19
32
|
|
|
20
33
|
## Prerequisites
|
|
34
|
+
|
|
21
35
|
- GitHub repository with Actions enabled
|
|
22
|
-
- Vercel
|
|
23
|
-
-
|
|
36
|
+
- Vercel project linked to the repo
|
|
37
|
+
- `VERCEL_TOKEN` stored as GitHub Secret
|
|
38
|
+
- `VERCEL_ORG_ID` and `VERCEL_PROJECT_ID` from `.vercel/project.json`
|
|
24
39
|
|
|
25
40
|
## Instructions
|
|
26
41
|
|
|
27
|
-
### Step 1:
|
|
28
|
-
Create `.github/workflows/vercel-integration.yml`:
|
|
42
|
+
### Step 1: Store CI Secrets in GitHub
|
|
29
43
|
|
|
30
|
-
```
|
|
31
|
-
|
|
44
|
+
```bash
|
|
45
|
+
# Get project and org IDs
|
|
46
|
+
cat .vercel/project.json
|
|
47
|
+
# {"orgId":"team_xxx","projectId":"prj_xxx"}
|
|
48
|
+
|
|
49
|
+
# Add secrets to GitHub repo
|
|
50
|
+
gh secret set VERCEL_TOKEN --body "your-vercel-token"
|
|
51
|
+
gh secret set VERCEL_ORG_ID --body "team_xxx"
|
|
52
|
+
gh secret set VERCEL_PROJECT_ID --body "prj_xxx"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 2: GitHub Actions — Preview on PR
|
|
32
56
|
|
|
57
|
+
```yaml
|
|
58
|
+
# .github/workflows/vercel-preview.yml
|
|
59
|
+
name: Vercel Preview Deployment
|
|
33
60
|
on:
|
|
34
|
-
push:
|
|
35
|
-
branches: [main]
|
|
36
61
|
pull_request:
|
|
37
62
|
branches: [main]
|
|
38
63
|
|
|
39
|
-
env:
|
|
40
|
-
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY }}
|
|
41
|
-
|
|
42
64
|
jobs:
|
|
43
|
-
|
|
65
|
+
deploy-preview:
|
|
44
66
|
runs-on: ubuntu-latest
|
|
45
|
-
env:
|
|
46
|
-
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY }}
|
|
47
67
|
steps:
|
|
48
68
|
- uses: actions/checkout@v4
|
|
49
|
-
|
|
69
|
+
|
|
70
|
+
- name: Install Vercel CLI
|
|
71
|
+
run: npm install -g vercel@latest
|
|
72
|
+
|
|
73
|
+
- name: Pull Vercel Environment
|
|
74
|
+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
|
75
|
+
env:
|
|
76
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
77
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
78
|
+
|
|
79
|
+
- name: Build Project
|
|
80
|
+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
|
81
|
+
env:
|
|
82
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
83
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
84
|
+
|
|
85
|
+
- name: Deploy Preview
|
|
86
|
+
id: deploy
|
|
87
|
+
run: |
|
|
88
|
+
url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
|
|
89
|
+
echo "preview_url=$url" >> $GITHUB_OUTPUT
|
|
90
|
+
env:
|
|
91
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
92
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
93
|
+
|
|
94
|
+
- name: Comment PR with Preview URL
|
|
95
|
+
uses: actions/github-script@v7
|
|
50
96
|
with:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
97
|
+
script: |
|
|
98
|
+
github.rest.issues.createComment({
|
|
99
|
+
issue_number: context.issue.number,
|
|
100
|
+
owner: context.repo.owner,
|
|
101
|
+
repo: context.repo.repo,
|
|
102
|
+
body: `Preview deployed: ${{ steps.deploy.outputs.preview_url }}`
|
|
103
|
+
})
|
|
56
104
|
```
|
|
57
105
|
|
|
58
|
-
### Step
|
|
59
|
-
```bash
|
|
60
|
-
gh secret set VERCEL_API_KEY --body "sk_test_***"
|
|
61
|
-
```
|
|
106
|
+
### Step 3: GitHub Actions — Production on Merge
|
|
62
107
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
expect(result.status).toBe('ok');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
```
|
|
108
|
+
```yaml
|
|
109
|
+
# .github/workflows/vercel-production.yml
|
|
110
|
+
name: Vercel Production Deployment
|
|
111
|
+
on:
|
|
112
|
+
push:
|
|
113
|
+
branches: [main]
|
|
73
114
|
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
-
|
|
115
|
+
jobs:
|
|
116
|
+
deploy-production:
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v4
|
|
79
120
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
121
|
+
- name: Install Vercel CLI
|
|
122
|
+
run: npm install -g vercel@latest
|
|
123
|
+
|
|
124
|
+
- name: Pull Vercel Environment
|
|
125
|
+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
|
126
|
+
env:
|
|
127
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
128
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
129
|
+
|
|
130
|
+
- name: Build Project
|
|
131
|
+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
|
132
|
+
env:
|
|
133
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
134
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
135
|
+
|
|
136
|
+
- name: Deploy Production
|
|
137
|
+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
|
|
138
|
+
env:
|
|
139
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
140
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
141
|
+
```
|
|
86
142
|
|
|
87
|
-
|
|
143
|
+
### Step 4: Test Gating — Run Tests Before Deploy
|
|
88
144
|
|
|
89
|
-
### Release Workflow
|
|
90
145
|
```yaml
|
|
146
|
+
# .github/workflows/vercel-gated.yml
|
|
147
|
+
name: Gated Vercel Deploy
|
|
91
148
|
on:
|
|
92
149
|
push:
|
|
93
|
-
|
|
150
|
+
branches: [main]
|
|
94
151
|
|
|
95
152
|
jobs:
|
|
96
|
-
|
|
153
|
+
test:
|
|
97
154
|
runs-on: ubuntu-latest
|
|
98
|
-
env:
|
|
99
|
-
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY_PROD }}
|
|
100
155
|
steps:
|
|
101
156
|
- uses: actions/checkout@v4
|
|
102
157
|
- uses: actions/setup-node@v4
|
|
103
|
-
with:
|
|
104
|
-
node-version: '20'
|
|
158
|
+
with: { node-version: 20 }
|
|
105
159
|
- run: npm ci
|
|
106
|
-
-
|
|
107
|
-
|
|
108
|
-
- run:
|
|
109
|
-
|
|
160
|
+
- run: npm test
|
|
161
|
+
- run: npm run lint
|
|
162
|
+
- run: npx tsc --noEmit
|
|
163
|
+
|
|
164
|
+
deploy:
|
|
165
|
+
needs: test # Only deploy if tests pass
|
|
166
|
+
runs-on: ubuntu-latest
|
|
167
|
+
steps:
|
|
168
|
+
- uses: actions/checkout@v4
|
|
169
|
+
- run: npm install -g vercel@latest
|
|
170
|
+
- run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
|
|
171
|
+
env:
|
|
172
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
173
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
174
|
+
- run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
|
|
175
|
+
env:
|
|
176
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
177
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
178
|
+
- run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
|
|
179
|
+
env:
|
|
180
|
+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
|
181
|
+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
110
182
|
```
|
|
111
183
|
|
|
112
|
-
###
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
184
|
+
### Step 5: Skip Builds for Non-Code Changes
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
// vercel.json — skip build when only docs change
|
|
188
|
+
{
|
|
189
|
+
"ignoreCommand": "git diff HEAD^ HEAD --quiet -- . ':!docs' ':!*.md' ':!.github'"
|
|
190
|
+
}
|
|
117
191
|
```
|
|
118
192
|
|
|
193
|
+
Or in the dashboard: **Settings > Git > Ignored Build Step**
|
|
194
|
+
|
|
195
|
+
### Step 6: Vercel's Built-In Git Integration (Alternative)
|
|
196
|
+
|
|
197
|
+
If you prefer Vercel's automatic deployments over custom CI:
|
|
198
|
+
|
|
199
|
+
1. Connect your GitHub repo in the Vercel dashboard
|
|
200
|
+
2. Vercel auto-deploys: preview on every push, production on merge to main
|
|
201
|
+
3. Configure in **Settings > Git**:
|
|
202
|
+
- Production branch: `main`
|
|
203
|
+
- Preview branches: all other branches
|
|
204
|
+
- Auto-assign custom domains to production
|
|
205
|
+
|
|
206
|
+
This approach requires zero CI configuration but gives less control over test gating.
|
|
207
|
+
|
|
208
|
+
## Output
|
|
209
|
+
|
|
210
|
+
- Preview deployments on every PR with URL comment
|
|
211
|
+
- Production deployments on merge to main (after tests pass)
|
|
212
|
+
- Test gating preventing broken code from reaching production
|
|
213
|
+
- Build skip rules for documentation-only changes
|
|
214
|
+
|
|
215
|
+
## Error Handling
|
|
216
|
+
|
|
217
|
+
| Error | Cause | Solution |
|
|
218
|
+
|-------|-------|----------|
|
|
219
|
+
| `Error: VERCEL_TOKEN is not set` | Secret not configured | Add `VERCEL_TOKEN` as GitHub repo secret |
|
|
220
|
+
| `Error: Could not find project` | Wrong ORG_ID or PROJECT_ID | Check `.vercel/project.json` values |
|
|
221
|
+
| `vercel pull` fails | Token lacks project access | Regenerate token with correct scope |
|
|
222
|
+
| Preview not commenting on PR | Missing `actions/github-script` | Add the comment step with correct permissions |
|
|
223
|
+
| Build cache not working | CI runs on fresh runner | Use `actions/cache` for `node_modules` and `.vercel/output` |
|
|
224
|
+
|
|
119
225
|
## Resources
|
|
120
|
-
|
|
121
|
-
- [Vercel CI
|
|
226
|
+
|
|
227
|
+
- [Vercel CLI in CI](https://vercel.com/docs/cli/deploying-from-cli)
|
|
228
|
+
- [GitHub Actions](https://docs.github.com/en/actions)
|
|
229
|
+
- [Vercel Git Integration](https://vercel.com/docs/deployments/git)
|
|
230
|
+
- [Ignored Build Step](https://vercel.com/docs/project-configuration#ignorecommand)
|
|
122
231
|
|
|
123
232
|
## Next Steps
|
|
124
|
-
|
|
233
|
+
|
|
234
|
+
For deployment orchestration, see `vercel-deploy-integration`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Error Handling Reference
|
|
2
|
+
|
|
3
|
+
| Issue | Cause | Solution |
|
|
4
|
+
|-------|-------|----------|
|
|
5
|
+
| Secret not found | Missing configuration | Add secret via `gh secret set` |
|
|
6
|
+
| Tests timeout | Network issues | Increase timeout or mock |
|
|
7
|
+
| Auth failures | Invalid key | Check secret value |
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Examples
|
|
2
|
+
|
|
3
|
+
### Release Workflow
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ['v*']
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
env:
|
|
14
|
+
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY_PROD }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: '20'
|
|
20
|
+
- run: npm ci
|
|
21
|
+
- name: Verify Vercel production readiness
|
|
22
|
+
run: npm run test:integration
|
|
23
|
+
- run: npm run build
|
|
24
|
+
- run: npm publish
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Branch Protection
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
required_status_checks:
|
|
31
|
+
- "test"
|
|
32
|
+
- "vercel-integration"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## Implementation Guide
|
|
2
|
+
|
|
3
|
+
### Step 1: Create GitHub Actions Workflow
|
|
4
|
+
|
|
5
|
+
Create `.github/workflows/vercel-integration.yml`:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
name: Vercel Integration Tests
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [main]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [main]
|
|
15
|
+
|
|
16
|
+
env:
|
|
17
|
+
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY }}
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
env:
|
|
23
|
+
VERCEL_API_KEY: ${{ secrets.VERCEL_API_KEY }}
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: '20'
|
|
29
|
+
cache: 'npm'
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm test -- --coverage
|
|
32
|
+
- run: npm run test:integration
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 2: Configure Secrets
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gh secret set VERCEL_API_KEY --body "sk_test_***"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 3: Add Integration Tests
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
describe('Vercel Integration', () => {
|
|
45
|
+
it.skipIf(!process.env.VERCEL_API_KEY)('should connect', async () => {
|
|
46
|
+
const client = getVercelClient();
|
|
47
|
+
const result = await client.healthCheck();
|
|
48
|
+
expect(result.status).toBe('ok');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|