Skip to main content

Migrating from Other CI/CD

1. Migrating from Jenkins

Feature GitHub Actions Equivalent Notes
Build Triggers on.schedule, on.push, on.pull_request Jenkins triggers like SCM polling map to schedule or push
Pipeline Stages jobs and steps Each Jenkins stage becomes a job; steps are individual actions or scripts
Build Environment runs-on, container Use ubuntu-latest, macOS-latest, or windows-latest for OS; containers for custom environments
Variables & Parameters env, inputs Environment variables via env; parameters via inputs in workflows
Artifacts & Archives actions/upload-artifact, actions/download-artifact Upload and download build artifacts using GitHub Actions built-in actions
Notifications on.failure, on.success Use webhook or email actions to notify on build status changes

Example: Migrating a Jenkins Pipeline Stage to GitHub Actions

name: Migrate Jenkins Stage
on:
  push:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
      - name: Run Tests
        run: npm test
Note: Jenkins pipelines are declarative, while GitHub Actions workflows are YAML-based and more modular.

Migration Steps Overview

  • Identify Jenkins stages and their dependencies
  • Map each stage to a GitHub Actions job
  • Convert Jenkins environment variables to env
  • Replace Jenkins plugins with GitHub Actions actions
  • Use actions/upload-artifact to store build artifacts

Jenkins vs GitHub Actions

  • Build Triggers: Jenkins uses SCM polling, GitHub Actions uses on.schedule
  • Stages: Jenkins stages map to GitHub Jobs; steps are individual actions
  • Environment: Jenkins uses agent, GitHub Actions uses runs-on
  • Variables: Jenkins uses environment variables, GitHub Actions uses env

2. Migrating from Travis CI

Travis CI Feature GitHub Actions Equivalent Notes
.travis.yml workflow_dispatch or push triggers Configuration file is .github/workflows/ directory
language runs-on with ubuntu-latest, macOS-latest, or windows-latest Uses matrix strategy for OS support
script steps array with run Each command becomes a step
env env in job or step Environment variables can be set per job or step
before_install steps with run Run before other steps using run
install steps with run Install dependencies using run
before_script steps with run Run before test scripts using run
script steps with run Run tests using run
after_success steps with run Run after successful job using run
after_failure steps with run Run after failed job using run
matrix strategy.matrix Supports parallel builds with different configurations
branches on.push.branches Filter workflows by branch names
tags on.push.tags Filter workflows by tag names
cron on.schedule Schedule workflows using cron syntax
notifications on.failure or on.success Use webhook or email notifications

Example: Migrating a Travis CI job to GitHub Actions

name: Migrate Travis CI to GitHub Actions
on:
  push:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
      - name: Install dependencies
        run: npm install
      - name: Run tests
        run: npm test

Travis CI vs GitHub Actions

  • Configuration: Travis CI uses .travis.yml, GitHub Actions uses YAML files in .github/workflows/
  • Environment: Travis CI has limited environment variables, GitHub Actions provides more flexibility
  • Matrix: Both support matrix builds but GitHub Actions has more granular control
  • Scheduling: Travis CI uses cron syntax, GitHub Actions supports more complex scheduling
  • Notifications: Travis CI has built-in notifications, GitHub Actions requires custom configuration

3. Migrating from CircleCI

CircleCI vs GitHub Actions

  • Configuration: CircleCI uses .circleci/config.yml; GitHub Actions uses .github/workflows/ directory with YAML files.
  • Workflow Trigger: CircleCI uses triggers; GitHub Actions uses on: keyword.
  • Environment Variables: CircleCI uses env in config; GitHub Actions uses env: in jobs.
  • Artifacts: CircleCI uses store_artifacts; GitHub Actions uses actions/upload-artifact.
  • Parallelism: CircleCI uses parallelism; GitHub Actions uses strategy.
CircleCI Concept GitHub Actions Equivalent Notes
jobs jobs Same purpose, different syntax
steps steps Same structure, different syntax
executor container or runs-on CircleCI executors map to GitHub container or runner types
environment variables env Same concept, different key names
artifacts actions/upload-artifact GitHub Actions requires explicit artifact upload

Example: Migrating a CircleCI Job to GitHub Actions

# CircleCI config.yml
version: 2.1
jobs:
  build:
    docker:
      - image: node:18
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: npm install
      - run:
          name: Run tests
          command: npm test
      - store_artifacts:
          path: coverage/
# GitHub Actions workflow.yml
name: CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: node:18
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: npm install
      - name: Run tests
        run: npm test
      - uses: actions/upload-artifact@v4
        with:
          name: coverage
          path: coverage/

Migration Steps

  • Identify CircleCI jobs and their steps
  • Map each job to a GitHub Actions workflow
  • Convert CircleCI configuration syntax to YAML format for GitHub Actions
  • Replace CircleCI-specific steps with equivalent GitHub Actions actions
  • Test workflows in a new branch before merging to main

4. Migrating from GitLab CI

Key Differences: GitHub Actions vs GitLab CI

  • Workflow Definition: GitHub Actions uses YAML in .github/workflows/ directory; GitLab CI uses .gitlab-ci.yml
  • Runner Environment: GitHub Actions provides hosted runners (Ubuntu, macOS, Windows); GitLab CI uses shared or self-hosted runners
  • Matrix Strategy: Both support matrix builds, but syntax differs slightly
  • Secrets Management: GitHub Actions uses secrets; GitLab CI uses $CI_JOB_TOKEN or $GITLAB_USER_LOGIN
Feature GitHub Actions GitLab CI Notes
Workflow Trigger on: with events like push, pull_request trigger: with push, merge_request Similar concepts but different syntax
Job Dependencies needs: to define job order stage: and dependencies GitHub Actions uses explicit job dependencies
Environment Variables env: in job or workflow variables: in job or global Same purpose, different structure
Artifacts actions/upload-artifact artifacts: in job config GitHub Actions requires explicit upload/download steps

Example: Migrating a Simple Build Job

# GitLab CI
build_job:
  stage: build
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist/

# GitHub Actions
build_job:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '18'
    - name: Install dependencies
      run: npm install
    - name: Build project
      run: npm run build
    - uses: actions/upload-artifact@v4
      with:
        name: dist
        path: dist/

Migration Steps Overview

  • Identify all GitLab CI jobs and their triggers
  • Convert each job to a GitHub Actions workflow YAML file
  • Map GitLab variables to GitHub Secrets or Environment Variables
  • Replace GitLab-specific steps with equivalent GitHub Actions steps
  • Test workflows in a new branch before merging to main
Note: GitHub Actions supports more extensive customization and parallelism than GitLab CI, but requires more explicit configuration for complex builds.

5. Migrating from Azure Pipelines

Feature Azure Pipelines GitHub Actions Notes
YAML Definition Defined in .yaml files within Azure DevOps Defined in .yml files in .github/workflows Structure is similar but syntax differs
Trigger Events Supports trigger, schedule, and pull_request Supports push, pull_request, schedule, and workflow_dispatch GitHub Actions has more flexible triggers
Variables Uses variables in pipeline YAML Uses env or secrets in workflow YAML GitHub Actions supports secrets natively
Stages Uses stages with jobs Uses jobs directly under steps GitHub Actions stages are more granular

Example: Migrating a Simple Pipeline

# Azure Pipelines
trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: |
    echo "Hello World"
  displayName: 'Run Hello World'
# GitHub Actions
on:
  push:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Run Hello World
        run: echo "Hello World"

Key Differences

  • Trigger: Azure Pipelines uses trigger, GitHub Actions uses on
  • Environment: Azure Pipelines uses pool, GitHub Actions uses runs-on
  • Steps: Azure Pipelines uses steps, GitHub Actions uses steps but with more flexibility
  • Variables: Azure Pipelines has variables, GitHub Actions uses env or secrets
Note: GitHub Actions provides more granular control over job execution and better integration with the GitHub ecosystem.

6. Converting Pipeline Stages

Stage Description GitHub Actions Equivalent Notes
build Compiles source code into executable binaries or packages. jobs.<job_id>.steps with uses: actions/checkout@v4 and build commands. Use actions/setup-node@v4 or similar for language-specific setups.
test Runs unit, integration, and end-to-end tests. jobs.<job_id>.steps with npm test or equivalent. Supports matrix testing via strategy.matrix.
deploy Deploys built artifacts to production or staging environments. jobs.<job_id>.steps with deployment scripts or tools like aws-cli. Use secrets for sensitive data (e.g., API keys, tokens).
release Creates and publishes releases (e.g., GitHub Releases, npm packages). jobs.<job_id>.steps with actions/create-release@v1 or custom scripts. Can be triggered on tags (e.g., on: push.tags).

Example: Converting a Build Stage

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Build project
        run: npm run build

Example: Converting a Test Stage

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm test

Example: Converting a Deploy Stage

jobs:
  deploy:
    runs-on: ubuntu-latest
    needs: [build, test]
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Deploy to production
        run: |
          echo "Deploying to production..."
          # Add deployment logic here (e.g., using AWS CLI or SSH)

7. Converting Build Steps

Build Step GitHub Actions Equivalent Notes
npm install npm install Install dependencies using npm
yarn install yarn install Install dependencies using yarn
npm run build npm run build Run the build script defined in package.json
make test make test Execute tests using Makefile target
docker build docker build -t myapp . Build a Docker image from the Dockerfile

Example: Converting npm install and build steps

name: Convert Build Steps
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm install

      - name: Build project
        run: npm run build

8. Migrating Environment Variables

Source CI/CD Environment Variable Mapping Notes
GitLab CI CI_COMMIT_SHA → GITHUB_SHA Maps commit SHA to GitHub context
GitLab CI CI_COMMIT_REF_NAME → GITHUB_REF Maps branch/tag name to ref
CircleCI CIRCLE_SHA1 → GITHUB_SHA Maps commit SHA to GitHub context
CircleCI CIRCLE_BRANCH → GITHUB_REF Maps branch name to ref
Jenkins BUILD_NUMBER → GITHUB_RUN_NUMBER Maps build number to GitHub run number
Jenkins BRANCH_NAME → GITHUB_REF Maps branch name to ref

Example: Setting Environment Variables in GitHub Actions

jobs:
  build:
    steps:
      - name: Set environment variables
        run: |
          echo "MY_VAR=value" >> $GITHUB_ENV
Note: Use GITHUB_ENV to set environment variables in GitHub Actions workflows.

9. Converting Caching Logic

Source CI/CD GitHub Actions Equivalent Notes
CircleCI actions/cache Use actions/cache with key and restore-keys
Travis CI actions/cache Cache paths using restore-keys and key
Jenkins actions/cache Cache directories using key and restore-keys
GitLab CI actions/cache Use cache with key and paths

Example: CircleCI to GitHub Actions Caching

steps:
  - name: Cache dependencies
    uses: actions/cache@v3
    with:
      path: |
        ~/.npm
        ~/.cache
      key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Note: The actions/cache action supports caching directories and files. It uses a key to identify the cache and restore-keys for fallback.

10. Migrating Artifacts

Artifact Type Description Migration Path
Build Artifacts Files generated during the build process (e.g., binaries, packages) Use actions/upload-artifact to upload and actions/download-artifact to download in GitHub Actions
Test Reports Reports from test runs (e.g., JUnit XML, coverage data) Upload using actions/upload-artifact with appropriate paths and names
Logs Build or test logs for debugging Use actions/upload-artifact to capture logs in a structured way

Example: Upload Build Artifacts

steps:
  - name: Build
    run: |
      npm run build
  - name: Upload Artifact
    uses: actions/upload-artifact@v4
    with:
      name: build-output
      path: dist/

Example: Download Artifacts

steps:
  - name: Download Artifact
    uses: actions/download-artifact@v4
    with:
      name: build-output
      path: dist/
Note: Artifacts are stored for 90 days by default in GitHub Actions.

11. Converting Matrix Builds

Feature GitHub Actions Other CI/CD Notes
matrix.strategy strategy: { matrix: { os: ['ubuntu-latest', 'windows-latest'], node-version: ['14', '16'] } } Often uses matrix in YAML or JSON config files Supports multiple dimensions like OS and Node version
matrix.include include: [{ os: 'macos-latest', node-version: '18' }] Custom matrix entries in config files Adds additional build combinations not covered by the base matrix
matrix.exclude exclude: [{ os: 'windows-latest', node-version: '14' }] Filtering or exclusion rules in config Removes specific combinations from the matrix

Example: Matrix Build Configuration

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [14, 16, 18]
    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci

Example: Including Custom Matrix Entry

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        node-version: [14, 16]
        include:
          - os: macos-latest
            node-version: 18
    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
Note: In other CI systems, matrix builds may be defined differently (e.g., in Jenkins or GitLab CI), often requiring more complex configuration files or plugins.

12. Migrating Deployment Scripts

Feature Description Migration Path
GitHub Actions Automated deployment using workflows and jobs Replace CI/CD steps with GitHub Actions YAML syntax
Deployment Triggers Triggers on push, pull request, or manual dispatch Map existing triggers to on: events in YAML
Environment Variables Securely manage secrets with GitHub Secrets Use secrets.VARIABLE_NAME in workflows
Artifact Management Store and retrieve build artifacts Use actions/upload-artifact and actions/download-artifact

Example: Migrating a Deployment Script

name: Deploy to Production
on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Dependencies
        run: npm ci

      - name: Deploy to Server
        run: |
          echo "Deploying to production server..."
          ssh user@server "cd /app && npm run deploy"
        env:
          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
Note: Ensure all environment variables and secrets are properly configured in GitHub Settings > Secrets and Variables.

13. Testing Migrated Workflows

Example: Basic workflow test

name: Test Workflow
on:
  pull_request:
    branches: [ main ]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Run tests
        run: |
          npm install
          npm test
Property Description Values
on.pull_request Triggers workflow on pull request branches, paths
jobs.test.runs-on Runner environment for job ubuntu-latest, macos-latest, windows-latest
Note: Ensure all dependencies are installed in the test environment.

Testing Migration Steps

  1. Run workflow manually from GitHub UI
  2. Verify logs match expected behavior
  3. Check for any missing environment variables
  4. Confirm all jobs execute successfully

Migration Testing vs Manual Testing

  • Automated: Runs on every commit, ensures consistency
  • Manual: Performed by developer, less reliable

Was this article helpful?