// This skill should be used when creating or configuring CI/CD pipeline files for automated testing, building, and deployment. Use this for generating GitHub Actions workflows, GitLab CI configs, CircleCI configs, or other CI/CD platform configurations. Ideal for setting up automated pipelines for Node.js/Next.js applications, including linting, testing, building, and deploying to platforms like Vercel, Netlify, or AWS.
| name | cicd-pipeline-generator |
| description | This skill should be used when creating or configuring CI/CD pipeline files for automated testing, building, and deployment. Use this for generating GitHub Actions workflows, GitLab CI configs, CircleCI configs, or other CI/CD platform configurations. Ideal for setting up automated pipelines for Node.js/Next.js applications, including linting, testing, building, and deploying to platforms like Vercel, Netlify, or AWS. |
Generate production-ready CI/CD pipeline configuration files for various platforms (GitHub Actions, GitLab CI, CircleCI, Jenkins). This skill provides templates and guidance for setting up automated workflows that handle linting, testing, building, and deployment for modern web applications, particularly Node.js/Next.js projects.
Choose the appropriate CI/CD platform based on project requirements:
Refer to references/platform-comparison.md for detailed platform comparisons, pros/cons, and use case recommendations.
Generate pipeline configs following these principles:
Structure pipelines with these standard stages:
Install Dependencies
npm ciLint
Test
Build
Deploy
Implement effective caching to speed up builds:
# Cache node_modules based on package-lock.json
cache:
key: ${{ hashFiles('package-lock.json') }}
paths:
- node_modules/
- .npm/
Configure necessary environment variables:
NODE_ENV: Set to production for buildsUse provided templates from assets/ directory:
GitHub Actions Template (assets/github-actions-nodejs.yml):
GitLab CI Template (assets/gitlab-ci-nodejs.yml):
To use a template:
.github/workflows/ci.yml.gitlab-ci.ymlFor GitHub Actions:
- 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 }}
vercel-args: '--prod'
Required Secrets:
VERCEL_TOKEN: Get from Vercel account settingsVERCEL_ORG_ID: From Vercel project settingsVERCEL_PROJECT_ID: From Vercel project settings- run: |
npm install -g netlify-cli
netlify deploy --prod --dir=.next
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: |
aws s3 sync .next/static s3://${{ secrets.S3_BUCKET }}/static
aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DIST_ID }} --paths "/*"
Configure test execution with proper reporting:
Jest Configuration:
- name: Run tests with coverage
run: npm test -- --coverage --coverageReporters=text --coverageReporters=lcov
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: unittests
Fail Fast Strategy:
# Run quick tests first
jobs:
lint: # Fails in ~30 seconds
test: # Fails in ~2 minutes
build: # Fails in ~5 minutes
needs: [lint, test]
deploy:
needs: [build]
Implement different behaviors per branch:
Feature Branches / PRs:
Develop Branch:
Main Branch:
Example:
deploy_staging:
if: github.ref == 'refs/heads/develop'
# Deploy to staging
deploy_production:
if: github.ref == 'refs/heads/main'
environment: production # Requires manual approval
# Deploy to production
Follow this decision tree to generate the appropriate pipeline:
Which platform?
assets/github-actions-nodejs.ymlassets/gitlab-ci-nodejs.ymlreferences/platform-comparison.mdWhat stages are needed?
Which deployment platform?
What triggers?
What environment variables needed?
*** masking)18.x not just 18)package-lock.json)continue-on-error for non-critical stepsdeploy_staging:
environment: staging
if: github.ref == 'refs/heads/develop'
deploy_production:
environment: production
if: github.ref == 'refs/heads/main'
needs: [deploy_staging]
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest]
- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npm run deploy
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: build-output
path: .next/
retention-days: 7
- name: Download build
uses: actions/download-artifact@v4
with:
name: build-output
assets/)github-actions-nodejs.yml: Complete GitHub Actions workflowgitlab-ci-nodejs.yml: Complete GitLab CI pipelinereferences/)platform-comparison.md: Detailed comparison of CI/CD platforms, deployment targets, best practices, and common patternsUser Request: "Create a GitHub Actions workflow that runs tests and deploys to Vercel"
Steps:
assets/github-actions-nodejs.yml template.github/workflows/ directory if it doesn't exist.github/workflows/ci.ymlVERCEL_TOKENVERCEL_ORG_IDVERCEL_PROJECT_IDUser Request: "Set up GitLab CI with staging and production environments"
Steps:
assets/gitlab-ci-nodejs.yml template.gitlab-ci.yml in repository rootVERCEL_TOKENpaths:
- 'apps/frontend/**'
- 'packages/**'
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM
- name: Notify Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
webhook_url: ${{ secrets.SLACK_WEBHOOK }}
- name: Run security audit
run: npm audit --audit-level=moderate
- name: Check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}