Automated summary
A reference guide for writing CI/CD pipelines with GitHub Actions: triggers, matrices, caching, permissions, and release automation.
Strengths
- Actionable trigger decision tree (push, pull_request, tags, schedule, workflow_dispatch, workflow_call)
- Per-ecosystem cache table (npm, pnpm, Go, Cargo, pip/uv, Docker, Gradle) with paths and restore keys
- Complete workflow skeleton with least-privilege permissions and a concurrency block to cancel duplicate runs
- Points to release automation tooling (semantic-release, changesets, goreleaser) and reusable workflows
Limitations
- The provided content cuts off mid-table (Gradle row), so the advertised release automation section is not actually detailed
- Heavily GitHub Actions-centric: no GitLab CI, CircleCI, or Jenkins equivalents
- Limited security depth beyond token scoping (no OIDC secrets, action pinning, or provenance guidance)
Use it when drafting or reviewing a GitHub Actions workflow with triggers, a test matrix, and dependency caching.
Skip it if your CI runs on GitLab, Jenkins, or CircleCI, or if you need detailed release-publishing patterns.
Security analysis
SafeThis is a documentation-style reference for GitHub Actions and CI/CD patterns. It contains no executable payloads, no curl|sh installs, no destructive commands, and no instructions to exfiltrate secrets. The secret-handling guidance is actually defensive (masking, least-privilege permissions, OIDC). The declared tools (Read Write Bash) are consistent with helping a user author workflow YAML, and nothing in the content directs harmful use of them.
No concerns found
How this analysis is madeExamples
Write a GitHub Actions workflow that runs npm ci and npm test on pull requests to main, with Node 18/20/22 in a matrix and npm caching enabled.Add a workflow that triggers on tags matching v* and publishes a release with goreleaser, using least-privilege permissions and a concurrency group.Create a workflow_dispatch pipeline that takes an environment input and deploys to it using a GitHub environment, skipping runs when only docs changed.name: ci-cd-ops description: "CI/CD pipeline patterns with GitHub Actions, release automation, and testing strategies. Use for: github actions, workflow, CI, CD, pipeline, deploy, release, semantic release, changesets, goreleaser, matrix, cache, secrets, environment, artifact, reusable workflow, composite action." license: MIT allowed-tools: "Read Write Bash" metadata: author: claude-mods related-skills: git-ops, docker-ops, testing-ops
CI/CD Operations
Comprehensive patterns for continuous integration, delivery, and deployment using GitHub Actions, release automation tools, and testing pipelines.
GitHub Actions Quick Reference
Workflow File Anatomy
name: CI # Display name in Actions tab
on: # Trigger events
push:
branches: [main]
pull_request:
branches: [main]
permissions: # GITHUB_TOKEN scope (least privilege)
contents: read
pull-requests: write
concurrency: # Prevent duplicate runs
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env: # Workflow-level environment variables
NODE_VERSION: "20"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- run: npm ci
- run: npm test
Core Syntax Elements
| Element | Purpose | Example |
|---------|---------|---------|
| on | Event triggers | push, pull_request, schedule |
| jobs.<id>.runs-on | Runner selection | ubuntu-latest, self-hosted |
| jobs.<id>.needs | Job dependencies | needs: [build, lint] |
| jobs.<id>.if | Conditional execution | if: github.event_name == 'push' |
| jobs.<id>.strategy.matrix | Parallel variants | node-version: [18, 20, 22] |
| jobs.<id>.environment | Deployment target | environment: production |
| jobs.<id>.permissions | Token scope | contents: write |
| steps[*].uses | Use an action | uses: actions/checkout@v4 |
| steps[*].run | Run a command | run: npm test |
| steps[*].env | Step environment | env: { CI: true } |
Trigger Decision Tree
| Scenario | Trigger | Config |
|----------|---------|--------|
| Run tests on every PR | pull_request | branches: [main] |
| Deploy on merge to main | push | branches: [main] |
| Release on version tag | push | tags: ['v*'] |
| Nightly builds | schedule | cron: '0 2 * * *' |
| Manual deployment | workflow_dispatch | inputs: { environment: ... } |
| Called by another workflow | workflow_call | inputs:, secrets: |
| On PR label change | pull_request | types: [labeled] |
| On issue comment | issue_comment | types: [created] |
| On release published | release | types: [published] |
| On package push | registry_package | types: [published] |
Trigger Filter Patterns
on:
push:
branches: [main, 'release/**'] # Branch patterns
paths: ['src/**', '!src/**/*.test.*'] # Path filters (ignore tests)
tags: ['v*'] # Tag patterns
pull_request:
types: [opened, synchronize, reopened] # Default types
paths-ignore: ['docs/**', '*.md'] # Ignore docs-only changes
Caching Strategies
| Ecosystem | Action / Key | Path | Restore Key |
|-----------|-------------|------|-------------|
| Node (npm) | actions/setup-node with cache: npm | Auto | Auto |
| Node (pnpm) | actions/setup-node with cache: pnpm | Auto | Auto |
| Go modules | actions/setup-go with cache: true | Auto | Auto |
| Cargo | actions/cache@v4 | ~/.cargo/registry, target | cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} |
| pip / uv | actions/setup-python with cache: pip | Auto | Auto |
| Docker layers | docker/build-push-action | Uses buildx cache | type=gha or type=registry |
| Gradle | actions/setup-java with cache: gradle | Auto | Auto |
| Composer | actions/cache@v4 | vendor | composer-${{ hashFiles('composer.lock') }} |
Manual Cache Example
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-
Matrix Strategy
strategy:
fail-fast: false # Don't cancel siblings on failure
max-parallel: 4 # Limit concurrent jobs
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20, 22]
include: # Add specific combos
- os: ubuntu-latest
node-version: 22
coverage: true
exclude: # Remove specific combos
- os: windows-latest
node-version: 18
Dynamic Matrix
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- id: set
run: echo "matrix=$(jq -c . matrix.json)" >> "$GITHUB_OUTPUT"
test:
needs: prepare
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
Secrets Management
| Scope | Access | Use Case | |-------|--------|----------| | Repository secrets | All workflows in repo | API keys, tokens | | Environment secrets | Jobs targeting that environment | Production credentials | | Organization secrets | Selected repos in org | Shared service accounts | | OIDC tokens | Federated identity | Cloud deployment (no stored secrets) |
Secrets Best Practices
# Reference secrets - NEVER echo or log them
- run: deploy --token ${{ secrets.DEPLOY_TOKEN }}
# Mask custom values
- run: echo "::add-mask::$CUSTOM_SECRET"
# Use environments for deployment secrets
jobs:
deploy:
environment: production # Requires approval + has secrets
steps:
- run: deploy --key ${{ secrets.PROD_API_KEY }}
OIDC for Cloud (No Stored Secrets)
permissions:
id-token: write
contents: read
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789:role/github-actions
aws-region: us-east-1
Common Workflow Patterns
Test on Pull Request
name: Test
on:
pull_request:
branches: [main]
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci
- run: npm run lint
- run: npm test -- --coverage
Deploy on Merge to Main
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
Release on Tag
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: |
gh release create ${{ github.ref_name }} \
--generate-notes \
--title "${{ github.ref_name }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Gotchas Table
| Gotcha | Problem | Fix |
|--------|---------|-----|
| Shallow clone | git describe fails, history missing | actions/checkout@v4 with fetch-depth: 0 |
| Default permissions | GITHUB_TOKEN is read-only by default | Set permissions: explicitly |
| Action pinning | @main can break without warning | Pin to SHA: @abc123 or @v4 |
| Fork PR secrets | Secrets unavailable on fork PRs | Use pull_request_target carefully |
| Concurrent deploys | Race condition on production | Use concurrency: groups |
| Stale caches | Cache grows unbounded | Include lockfile hash in key |
| Node.js version | setup-node defaults vary | Always specify node-version |
| Docker layer cache | Rebuilds everything without cache | Use cache-from: type=gha |
| Matrix + environment | Each matrix job needs approval | Use a single deploy job after matrix |
| Path filters + required checks | Skipped jobs block merge | Use paths-filter action or make checks non-required |
| GITHUB_TOKEN in PRs | Cannot trigger other workflows | Use a PAT or GitHub App token |
| Windows line endings | Scripts fail with \r\n | Use .gitattributes or core.autocrlf |
Expression Syntax Quick Reference
| Expression | Result |
|------------|--------|
| ${{ github.event_name }} | push, pull_request, etc. |
| ${{ github.ref_name }} | Branch or tag name |
| ${{ github.sha }} | Full commit SHA |
| ${{ github.actor }} | User who triggered |
| ${{ runner.os }} | Linux, Windows, macOS |
| ${{ contains(github.event.head_commit.message, '[skip ci]') }} | Check commit message |
| ${{ needs.build.outputs.version }} | Output from prior job |
| ${{ fromJson(steps.meta.outputs.json) }} | Parse JSON output |
| ${{ hashFiles('**/package-lock.json') }} | Hash for cache keys |
| ${{ format('refs/heads/{0}', matrix.branch) }} | String formatting |
| ${{ toJson(matrix) }} | Debug: print matrix config |
Step Outputs
steps:
- id: version
run: echo "value=$(cat VERSION)" >> "$GITHUB_OUTPUT"
- run: echo "Version is ${{ steps.version.outputs.value }}"
Job Outputs (for Cross-Job Communication)
jobs:
build:
runs-on: ubuntu-latest
outputs:
artifact-id: ${{ steps.upload.outputs.artifact-id }}
steps:
- id: upload
run: echo "artifact-id=abc123" >> "$GITHUB_OUTPUT"
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- run: echo "Deploying ${{ needs.build.outputs.artifact-id }}"
Reference Files
| File | Contents |
|------|----------|
| references/github-actions.md | Complete workflow syntax, reusable workflows, composite actions, OIDC, runners, debugging |
| references/release-automation.md | Semantic versioning, semantic-release, changesets, goreleaser, changelog, publishing |
| references/testing-pipelines.md | Test stages, parallelism, coverage, service containers, e2e in CI, deployment pipelines |
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/ci-cd-operations-mrwakawr/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/ci-cd-operations-mrwakawr' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/ci-cd-operations-mrwakawr/download' --output '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md.part' && mv '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md.part' '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read Write Bash
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && test -s '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ci-cd-ops' && cp -R '.skill-downloads/ci-cd-operations-mrwakawr' '.claude/skills/ci-cd-ops'Cursor
test -f '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && test -s '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/ci-cd-ops' && cp -R '.skill-downloads/ci-cd-operations-mrwakawr' '.cursor/skills/ci-cd-ops'Codex
test -f '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && test -s '.skill-downloads/ci-cd-operations-mrwakawr/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/ci-cd-ops' && cp -R '.skill-downloads/ci-cd-operations-mrwakawr' '.agents/skills/ci-cd-ops'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/ci-cd-operations-mrwakawr'openskills read 'ci-cd-operations-mrwakawr'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/ci-cd-operations-mrwakawr/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.