Build YAML-based CI/CD pipelines for GitLab CI and GitHub Actions with progressive disclosure. Use when creating GitLab YAML pipelines, configuring GitLab CI/CD or GitHub Actions workflows, designing multi-stage pipelines, implementing pipeline templates, or managing pipeline secrets and variables.
Purpose: Quick-reference guide for YAML-based CI/CD pipelines. Start here for platform selection, core patterns, and best practices. Dive into reference files for full examples.
| Feature | GitLab CI | GitHub Actions |
|---|---|---|
| Config File | .gitlab-ci.yml | .github/workflows/*.yml |
| Stages | [PASS] Native | [WARN] Jobs only |
| Templates | [PASS] Includes/Extends | [PASS] Reusable workflows |
| Caching | [PASS] Built-in | [PASS] actions/cache |
| Environments | [PASS] Native | [PASS] Native |
| Approvals | [PASS] Manual when | [PASS] Environment rules |
| Matrix | [PASS] parallel.matrix | [PASS] strategy.matrix |
| Secrets | [PASS] CI/CD Variables | [PASS] Secrets |
| Self-hosted | [PASS] Runners | [PASS] Self-hosted runners |
| Best for | Self-hosted / Enterprise | Open source / GitHub |
Is your code hosted on GitHub?
+- YES -> Use GitHub Actions (see ../github-actions-workflows/SKILL.md)
+- NO
| +- Using GitLab for SCM + task tracking + registry?
| | - YES -> Use GitLab CI (all-in-one DevOps)
| - Need self-hosted runners or on-prem CI?
| - Use GitLab CI (broadest self-hosted runner support)
Key considerations:
Every YAML pipeline shares these building blocks:
| Concept | GitLab CI | GitHub Actions |
|---|---|---|
| Trigger | rules: / only: / except: | on: (push/pull_request/schedule) |
| Stage | stages: [build, test, deploy] | N/A (jobs only) |
| Job | Job name at root level | jobs.<name>: |
| Step | script: array | steps: with run: / uses: |
| Template | include: + extends: | Reusable workflows (workflow_call) |
| Variable | variables: | env: / secrets: |
| Artifact | artifacts: | actions/upload-artifact |
| Cache | cache: keyword | actions/cache |
| Environment | environment: on job | environment: on job |
# .github/workflows/ci.yml