$npx -y skills add vibeeval/vibecosystem --skill ci-cd-pipelineGitHub Actions workflow patterns, matrix builds, caching strategies, deployment pipelines, artifact management, and rollback procedures.
| 1 | # CI/CD Pipeline Patterns |
| 2 | |
| 3 | GitHub Actions workflows for consistent, fast, and reliable delivery pipelines. |
| 4 | |
| 5 | ## Workflow Structure |
| 6 | |
| 7 | ```yaml |
| 8 | # .github/workflows/ci.yml |
| 9 | name: CI |
| 10 | |
| 11 | on: |
| 12 | push: |
| 13 | branches: [main, develop] |
| 14 | pull_request: |
| 15 | branches: [main] |
| 16 | workflow_dispatch: # manual trigger |
| 17 | |
| 18 | concurrency: |
| 19 | group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | cancel-in-progress: true # cancel outdated runs on same branch |
| 21 | |
| 22 | jobs: |
| 23 | lint: |
| 24 | runs-on: ubuntu-latest |
| 25 | steps: |
| 26 | - uses: actions/checkout@v4 |
| 27 | - uses: actions/setup-node@v4 |
| 28 | with: |
| 29 | node-version: '20' |
| 30 | cache: 'npm' |
| 31 | - run: npm ci |
| 32 | - run: npm run lint |
| 33 | |
| 34 | test: |
| 35 | runs-on: ubuntu-latest |
| 36 | needs: lint # runs after lint passes |
| 37 | steps: |
| 38 | - uses: actions/checkout@v4 |
| 39 | - uses: actions/setup-node@v4 |
| 40 | with: |
| 41 | node-version: '20' |
| 42 | cache: 'npm' |
| 43 | - run: npm ci |
| 44 | - run: npm test -- --coverage |
| 45 | |
| 46 | build: |
| 47 | runs-on: ubuntu-latest |
| 48 | needs: test |
| 49 | steps: |
| 50 | - uses: actions/checkout@v4 |
| 51 | - uses: actions/setup-node@v4 |
| 52 | with: |
| 53 | node-version: '20' |
| 54 | cache: 'npm' |
| 55 | - run: npm ci |
| 56 | - run: npm run build |
| 57 | ``` |
| 58 | |
| 59 | ## Matrix Builds |
| 60 | |
| 61 | Test across multiple versions and operating systems in parallel. |
| 62 | |
| 63 | ```yaml |
| 64 | jobs: |
| 65 | test: |
| 66 | strategy: |
| 67 | fail-fast: false # don't cancel others if one fails |
| 68 | matrix: |
| 69 | node: ['18', '20', '22'] |
| 70 | os: [ubuntu-latest, macos-latest, windows-latest] |
| 71 | exclude: |
| 72 | - os: windows-latest |
| 73 | node: '18' # skip this combination |
| 74 | |
| 75 | runs-on: ${{ matrix.os }} |
| 76 | name: Test Node ${{ matrix.node }} on ${{ matrix.os }} |
| 77 | |
| 78 | steps: |
| 79 | - uses: actions/checkout@v4 |
| 80 | - uses: actions/setup-node@v4 |
| 81 | with: |
| 82 | node-version: ${{ matrix.node }} |
| 83 | cache: 'npm' |
| 84 | - run: npm ci |
| 85 | - run: npm test |
| 86 | ``` |
| 87 | |
| 88 | ```yaml |
| 89 | # Python matrix example |
| 90 | jobs: |
| 91 | test: |
| 92 | strategy: |
| 93 | matrix: |
| 94 | python: ['3.10', '3.11', '3.12'] |
| 95 | django: ['4.2', '5.0'] |
| 96 | runs-on: ubuntu-latest |
| 97 | |
| 98 | steps: |
| 99 | - uses: actions/checkout@v4 |
| 100 | - uses: actions/setup-python@v5 |
| 101 | with: |
| 102 | python-version: ${{ matrix.python }} |
| 103 | - run: pip install django==${{ matrix.django }} -r requirements-test.txt |
| 104 | - run: pytest |
| 105 | ``` |
| 106 | |
| 107 | ## Dependency Caching |
| 108 | |
| 109 | ```yaml |
| 110 | # Node.js: cache npm or yarn |
| 111 | - uses: actions/setup-node@v4 |
| 112 | with: |
| 113 | node-version: '20' |
| 114 | cache: 'npm' # auto-caches ~/.npm |
| 115 | |
| 116 | # Manual cache (more control) |
| 117 | - uses: actions/cache@v4 |
| 118 | id: npm-cache |
| 119 | with: |
| 120 | path: ~/.npm |
| 121 | key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} |
| 122 | restore-keys: | |
| 123 | npm-${{ runner.os }}- |
| 124 | |
| 125 | - run: npm ci |
| 126 | ``` |
| 127 | |
| 128 | ```yaml |
| 129 | # Python: cache pip |
| 130 | - uses: actions/cache@v4 |
| 131 | with: |
| 132 | path: ~/.cache/pip |
| 133 | key: pip-${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }} |
| 134 | restore-keys: | |
| 135 | pip-${{ runner.os }}- |
| 136 | |
| 137 | - run: pip install -r requirements.txt |
| 138 | ``` |
| 139 | |
| 140 | ```yaml |
| 141 | # Docker layer caching |
| 142 | - uses: docker/setup-buildx-action@v3 |
| 143 | |
| 144 | - uses: actions/cache@v4 |
| 145 | with: |
| 146 | path: /tmp/.buildx-cache |
| 147 | key: buildx-${{ runner.os }}-${{ github.sha }} |
| 148 | restore-keys: | |
| 149 | buildx-${{ runner.os }}- |
| 150 | |
| 151 | - uses: docker/build-push-action@v5 |
| 152 | with: |
| 153 | cache-from: type=local,src=/tmp/.buildx-cache |
| 154 | cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |
| 155 | |
| 156 | # Prevent cache from growing unbounded |
| 157 | - run: | |
| 158 | rm -rf /tmp/.buildx-cache |
| 159 | mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
| 160 | ``` |
| 161 | |
| 162 | ## Artifact Upload/Download Between Jobs |
| 163 | |
| 164 | ```yaml |
| 165 | jobs: |
| 166 | build: |
| 167 | runs-on: ubuntu-latest |
| 168 | steps: |
| 169 | - uses: actions/checkout@v4 |
| 170 | - run: npm ci && npm run build |
| 171 | |
| 172 | - uses: actions/upload-artifact@v4 |
| 173 | with: |
| 174 | name: build-output |
| 175 | path: dist/ |
| 176 | retention-days: 7 |
| 177 | |
| 178 | deploy: |
| 179 | runs-on: ubuntu-latest |
| 180 | needs: build |
| 181 | steps: |
| 182 | - uses: actions/download-artifact@v4 |
| 183 | with: |
| 184 | name: build-output |
| 185 | path: dist/ |
| 186 | |
| 187 | - run: ls -la dist/ # verify artifact present |
| 188 | - run: ./scripts/deploy.sh |
| 189 | ``` |
| 190 | |
| 191 | ## Environment Secrets Management |
| 192 | |
| 193 | ```yaml |
| 194 | # Repository secrets: Settings → Secrets and variables → Actions |
| 195 | # Environment secrets: require approval before use |
| 196 | |
| 197 | jobs: |
| 198 | deploy-production: |
| 199 | environment: production # requires approval + uses env secrets |
| 200 | runs-on: ubuntu-latest |
| 201 | |
| 202 | steps: |
| 203 | - uses: actions/checkout@v4 |
| 204 | |
| 205 | - name: Deploy |
| 206 | env: |
| 207 | API_KEY: ${{ secrets.API_KEY }} |
| 208 | DATABASE_URL: ${{ secrets.DATABASE_URL }} |
| 209 | run: ./scripts/deploy.sh |
| 210 | |
| 211 | # Never echo secrets |
| 212 | # ✅ GitHub masks them automatically in logs |
| 213 | # ❌ Don't: run: echo ${{ secrets.API_KEY }} |
| 214 | ``` |
| 215 | |
| 216 | ## Full Deployment Pipeline |
| 217 | |
| 218 | ```yaml |
| 219 | # .github/workflows/deploy.yml |
| 220 | name: Deploy |
| 221 | |
| 222 | on: |
| 223 | push: |
| 224 | branches: [main] |
| 225 | |
| 226 | j |