GitHub Actions: The Complete CI/CD Platform Built Into GitHub
Everything you need to know about automating your build, test, and deployment pipelines with GitHub Actions.
By Ali Bashir · CI/CD · Mar 26, 2022 · 2 min read
GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request, or deploy merged code to production automatically.
Why GitHub Actions?
Built into GitHub - Fully integrated, no external CI system to configure or pay for separately. Pull requests, issues, and pipelines are all in one place.
Multi-container testing - Supports Docker and Docker Compose, enabling you to test against real service dependencies.
Marketplace ecosystem - Thousands of pre-built actions available. You can also publish your own.
Generous free tier - 2,000 build minutes/month for private repositories. Unlimited for open-source.
The Five Core Components
Workflows
A configurable automated process defined in a YAML file inside .github/workflows/. Triggered by events, schedules, or manually.
Events
Activities in your repository that trigger a workflow - a push, pull request, issue creation, or a scheduled cron.
Jobs
A set of steps that execute on the same runner. Jobs run in parallel by default, but can be sequenced using the needs keyword.
Actions
Reusable extensions that perform complex tasks - checking out code, setting up a language runtime, authenticating to a cloud provider.
Runners
Virtual machines that execute your workflows. GitHub provides Ubuntu, Windows, and macOS runners. You can also self-host.
A Real-World Workflow
name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build
run: npm run build
Conclusion
GitHub Actions removes the friction between writing code and shipping it. When CI/CD lives in the same repository as your code, every engineer on the team can understand, modify, and improve the pipeline - not just the DevOps team.