Home / How-to / GitHub Actions for Beginners: Set Up CI/CD Pipeline

GitHub Actions for Beginners: Set Up CI/CD Pipeline

GitHub Actions for Beginners guide screenshot or product visual for how-to readers
Table of Contents
  1. What Is GitHub Actions and Why Use It?
  2. Understanding Workflow File Structure
  3. Your First GitHub Actions Workflow: Step-by-Step
  4. Adding Deployment to Your CI/CD Pipeline
  5. Common Questions — How to Set Up GitHub Actions for Beginners
  6. Conclusion: Automate Everything With GitHub Actions

If you’ve been manually testing and deploying code, GitHub Actions can change how you work overnight. Setting up GitHub Actions for beginners is easier than you might think — you don’t need a DevOps background or a separate CI/CD server. GitHub Actions is built directly into GitHub, completely free for public repositories and generous for private ones. In this guide, you’ll learn what GitHub Actions is, how workflow files work, how to write your first pipeline, and how to automate real tasks like running tests and deploying code. By the end, you’ll have a working CI/CD pipeline you can adapt for any project.

System with various wires managing access to centralized resource of server in data center — Photo by Brett Sayles on Pexels

What Is GitHub Actions and Why Use It?

GitHub Actions is a CI/CD and automation platform built into GitHub. It lets you automatically run scripts, tests, and deployments triggered by events like code pushes, pull requests, or scheduled times.

Here’s why GitHub Actions stands out in 2026:

  • Zero setup: No separate Jenkins server, no CircleCI account needed — it lives inside your repo.
  • Free tier: 2,000 minutes/month free for private repos; unlimited for public repos.
  • Huge marketplace: Over 21,000 community actions available — deploy to AWS, run security scans, send Slack notifications, and more.
  • Matrix builds: Test against multiple Node.js, Python, or OS versions simultaneously.
  • Native GitHub integration: Triggers on PRs, issues, releases — any GitHub event.

According to GitHub’s 2025 Octoverse report, over 85 million workflows ran in October 2025 alone, making it the most widely used CI/CD platform in open source.

Understanding Workflow File Structure

Detailed view of a server rack with a focus on technology and data storage. — Photo by panumas nikhomkhai on Pexels

Every GitHub Actions pipeline is defined in a YAML workflow file stored in your repo at .github/workflows/. There’s no UI to configure — everything is code. This makes your pipeline version-controlled and repeatable. For more beginner how-to technology guides, browse our full tutorial library.

Here are the core building blocks:

ConceptWhat It IsExample
WorkflowThe full automation file.github/workflows/ci.yml
Event (on)What triggers the workflowpush, pull_request, schedule
JobA group of steps running on one runnerbuild, test, deploy
StepA single task inside a jobRun a command or use an action
ActionReusable unit from the marketplaceactions/checkout@v4
RunnerThe VM that executes jobsubuntu-latest, windows-latest
SecretEncrypted environment variableAPI keys, passwords

Your First GitHub Actions Workflow: Step-by-Step

Let’s build a real CI pipeline that installs dependencies, runs tests, and checks code quality on every push. We’ll use Node.js, but the pattern applies to any language.

Step 1: Create the Workflow File

In your repo, create the directory and file:

mkdir -p .github/workflows
touch .github/workflows/ci.yml

Step 2: Write the Workflow

Paste this into ci.yml:

name: CI Pipeline

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x, 20.x, 22.x]

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Run lint
        run: npm run lint

      - name: Run tests
        run: npm test

      - name: Upload test results
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: test-results-${{ matrix.node-version }}
          path: test-results/

Step 3: Push and Watch It Run

Commit and push the file:

git add .github/workflows/ci.yml
git commit -m "Add CI workflow"
git push origin main

Go to your GitHub repo and click the Actions tab. You’ll see your workflow running in real time. Green checkmarks mean all tests passed. Red X means something failed — click into the job to see the exact line that failed.

Adding Deployment to Your CI/CD Pipeline

Once your tests pass, you can automatically deploy. Here’s a simple deployment job that runs only on the main branch after tests pass:

  deploy:
    runs-on: ubuntu-latest
    needs: test
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Deploy to server
        env:
          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
          SERVER_HOST: ${{ secrets.SERVER_HOST }}
        run: |
          echo "$DEPLOY_KEY" > deploy_key
          chmod 600 deploy_key
          ssh -i deploy_key -o StrictHostKeyChecking=no user@$SERVER_HOST "cd /app && git pull && npm ci && pm2 restart app"
          rm deploy_key

Store your SSH key and server host in your repo’s Settings → Secrets and variables → Actions. Secrets are encrypted and never exposed in logs. For a deeper dive into automation tools, check out our DevOps and IT Ops resource hub.

Common Questions — How to Set Up GitHub Actions for Beginners

Q: Does GitHub Actions work with private repositories?

A: Yes. GitHub Actions works with both public and private repositories. Public repos get unlimited free minutes. Private repos on the free plan get 2,000 minutes/month (Linux runners). Paid plans include more minutes — Teams gets 3,000 minutes/month, Enterprise gets 50,000.

Q: What languages does GitHub Actions support?

A: GitHub Actions supports any language you can run on Linux, Windows, or macOS. There are setup actions for Node.js, Python, Java, Go, Ruby, PHP, .NET, Rust, and more. If there’s no official action, you can install any tool with a run step using apt, pip, or any package manager.

Q: How do I store secrets like API keys in GitHub Actions?

A: Go to your GitHub repo → Settings → Secrets and variables → Actions → New repository secret. Reference secrets in workflows as ${{ secrets.YOUR_SECRET_NAME }}. Secrets are masked in logs and never exposed to pull requests from forks (a security best practice).

Q: What is the difference between a job and a step in GitHub Actions?

A: A job is a collection of steps that run on the same virtual machine (runner). Steps run sequentially within a job. Jobs run in parallel by default unless you use needs to create dependencies. Use multiple jobs to separate concerns — one for testing, one for building, one for deploying.

Conclusion: Automate Everything With GitHub Actions

You’ve learned how to set up GitHub Actions for beginners: understanding workflow structure, writing your first CI pipeline, running tests across multiple Node versions, and adding automated deployment. Three key takeaways:

  • Start with a simple test runner — even a basic npm test step catches bugs before they reach production.
  • Use needs to chain jobs — test first, deploy only if tests pass. This prevents broken code from going live.
  • Secrets are sacred — never put API keys directly in workflow files. Always use GitHub Secrets for credentials.

The next step: add a workflow to your real project this week. Start with the CI template above, adapt the test command, and push it. Once you see that green checkmark on your first PR, you’ll never want to deploy manually again. If you pair GitHub Actions with an AI code editor like Cursor AI, the two tools create a powerful loop: Cursor writes the code, Actions tests and deploys it automatically. Not sure which editor to start with? Our VS Code vs Cursor comparison helps you decide. Explore more developer how-to guides to continue leveling up your skills.

About the author: TouchEVA is a tech journalist covering AI, software, and cybersecurity for Hubkub.com — independent tech media since 2025.

Last Updated: April 13, 2026

TouchEVA

TouchEVA

Founder and lead writer at Hubkub. Covers software, AI tools, cybersecurity, and practical Windows/Linux workflows.

Tagged: