Skip to content
Latchkey

How to Migrate From Travis CI to GitHub Actions

Travis stages map to Actions steps, the language image becomes a setup action, and the build matrix becomes strategy.matrix.

There is no automatic converter built into Travis, so you rebuild the pipeline by hand. Map language to a setup-* action, install/script to run: steps, the Travis matrix to strategy.matrix, and cache to actions/cache.

Concept mapping

.travis.ymlGitHub Actions
language: node_js + node_js:actions/setup-node with a matrix
install:a run: step (e.g. npm ci)
script:one or more run: steps
matrix / envstrategy.matrix
cache:actions/cache or the setup action cache input
deploy:a gated deploy job with if: and needs:

Before

.travis.yml
language: node_js
node_js:
  - "18"
  - "20"
cache:
  directories:
    - ~/.npm
install:
  - npm ci
script:
  - npm test

After

.github/workflows/ci.yml
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [18, 20]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test

What does not map cleanly

  • Travis build stages become separate jobs wired with needs:, not an ordered stage list.
  • Travis dist: images have no direct equivalent; pick a runs-on label and install tools yourself.
  • Secure env vars from Travis must be re-created as repository or environment secrets.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →