CI/CD流水线配置
生成CI/CD配置文件
提示词
请为项目生成CI/CD配置:
项目信息:
- 技术栈:[如Node.js/Python/Go]
- 仓库:[GitHub/GitLab]
- 部署目标:[如AWS/Vercel/自有服务器]
需要的流水线阶段:
1. 代码检查(lint)
2. 单元测试
3. 构建
4. 部署到[staging/production]
5. 通知
输出完整的配置文件(GitHub Actions/GitLab CI格式)。示例输出
# .github/workflows/ci.yml
name: CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: npm run lint
- run: npm test
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: vercel/action@v1
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}评论 0
更多
登录后可点赞、收藏、评论和举报。
还没有评论,先发起一个具体问题。