Skills.MD
# Linear Deploy Integration
## Overview
Deploy Linear-integrated applications and track deployments in Linear.
## Prerequisites
- Working Linear integration
- Deployment platform account (Vercel, Railway, Cloud Run, etc.)
- CI/CD pipeline configured
## Instructions
### Step 1: Vercel Deployment
```bash
# Install Vercel CLI
npm install -g vercel
# Configure environment variables
vercel env add LINEAR_API_KEY production
vercel env add LINEAR_WEBHOOK_SECRET production
# Deploy
vercel --prod
```
```json
// vercel.json
{
"env": {
"LINEAR_API_KEY": "@linear-api-key",
"LINEAR_WEBHOOK_SECRET": "@linear-webhook-secret"
},
"functions": {
"api/webhooks/linear.ts": {
"maxDuration": 30
}
}
}
```
### Step 2: Google Cloud Run Deployment
```bash
# Build and push container
gcloud builds submit --tag gcr.io/PROJECT_ID/linear-integration
# Deploy with secrets
gcloud run deploy linear-integration \
--image gcr.io/PROJECT_ID/linear-integration \
--platform managed \
--region us-central1 \
--set-secrets="LINEAR_API_KEY=linear-api-key:latest,LINEAR_WEBHOOK_SECRET=linear-webhook-secret:latest" \
--allow-unauthenticated
```
```yaml
# cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/linear-integration', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/linear-integration']
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- 'linear-integration'
- '--image=gcr.io/$PROJECT_ID/linear-integration'
- '--region=us-central1'
- '--platform=managed'
```
### Step 3: Railway Deployment
```bash
# Install Railway CLI
npm install -g @railway/cli
# Login and initialize
railway login
railway init
# Set environment variables
railway variables set LINEAR_API_KEY=lin_api_xxxx
railway variables set LINEAR_WEBHOOK_SECRET=secret
# Deploy
railway up
```
### Step 4: Deployment Tracking in Linear
```typescript
// scripts/notify-linear-deploy.ts
import { LinearClient } from "@linear/sdk";
interface DeploymentInfo {
environment: "staging" | "production";
version: string;
commitSha: string;
deployUrl: string;
issueIdentifiers: string[];
}
async function notifyLinearDeploy(info: DeploymentInfo) {
const client = new LinearClient({
apiKey: process.env.LINEAR_API_KEY!,
});
// Add deployment comment to each issue
for (const identifier of info.issueIdentifiers) {
try {
const issue = await client.issue(identifier);
await client.createComment({
issueId: issue.id,
body: `## Deployed to ${info.environment}
**Version:** ${info.version}
**Commit:** \`${info.commitSha.slice(0, 7)}\`
**URL:** ${info.deployUrl}
**Time:** ${new Date().toISOString()}`,
});
// If production deploy, mark issue as done
if (info.environment === "production") {
const team = await issue.team;
const states = await team?.states();
const doneState = states?.nodes.find(s => s.type === "completed");
if (doneState) {
await client.updateIssue(issue.id, { stateId: doneState.id });
}
}
console.log(`Updated ${identifier}`);
} catch (error) {
console.error(`Failed to update ${identifier}:`, error);
}
}
}
// Usage
notifyLinearDeploy({
environment: "production",
version: process.env.VERSION!,
commitSha: process.env.COMMIT_SHA!,
deployUrl: process.env.DEPLOY_URL!,
issueIdentifiers: process.env.ISSUE_IDS!.split(","),
});
```
### Step 5: GitHub Actions Deployment Workflow
```yaml
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract Linear Issues
id: issues
run: |
# Get issues from commits since last deploy
ISSUES=$(git log ${{ github.event.before }}..${{ github.sha }} --oneline | grep -oE '[A-Z]+-[0-9]+' | sort -u | tr '\n' ',' | sed 's/,$//')
echo "ids=$ISSUES" >> $GITHUB_OUTPUT
- name: Deploy to Production
id: deploy
run: |
# Your deploy command here
DEPLOY_URL=$(vercel --prod --token ${{ secrets.VERCEL_TOKEN }} | tail -1)
echo "url=$DEPLOY_URL" >> $GITHUB_OUTPUT
- name: Notify Linear
run: |
npx ts-node scripts/notify-linear-deploy.ts
env:
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
VERSION: ${{ github.sha }}
COMMIT_SHA: ${{ github.sha }}
DEPLOY_URL: ${{ steps.deploy.outputs.url }}
ISSUE_IDS: ${{ steps.issues.outputs.ids }}
```
### Step 6: Rollback Tracking
```typescript
// scripts/notify-linear-rollback.ts
import { LinearClient } from "@linear/sdk";
async function notifyRollback(options: {
version: string;
reason: string;
affectedIssues: string[];
}) {
const client = new LinearClient({
apiKey: process.env.LINEAR_API_KEY!,
});
for (const identifier of options.affectedIssues) {
const issue = await client.issue(identifier);
// Reopen the issue
const team = await issue.team;
const states = await team?.states();
const inProgressState = states?.nodes.find(s =>
s.name.toLowerCase().includes("progress")
);
if (inProgressState) {
await client.updateIssue(issue.id, { stateId: inProgressState.id });
}
await client.createComment({
issueId: issue.id,
body: `## Production Rollback
**Rolled back version:** ${options.version}
**Reason:** ${options.reason}
**Time:** ${new Date().toISOString()}
This issue has been reopened for investigation.`,
});
}
}
```
## Deployment Checklist
```
[ ] Environment variables configured on platform
[ ] Secrets stored securely (not in code)
[ ] Webhook endpoint accessible from internet
[ ] Health check endpoint configured
[ ] Deployment notifications enabled
[ ] Rollback procedure documented
```
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `Secret not found` | Missing env var | Configure secrets on platform |
| `Webhook timeout` | Long processing | Increase function timeout |
| `Connection refused` | Firewall blocking | Check egress rules |
## Resources
- [Vercel Environment Variables](https://vercel.com/docs/environment-variables)
- [Cloud Run Secrets](https://cloud.google.com/run/docs/configuring/secrets)
- [Linear Deployment Tracking](https://linear.app/docs/git-integrations)
## Next Steps
Set up webhooks with `linear-webhooks-events`.
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「linear-deploy-integration」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次