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.yml | GitHub 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 / env | strategy.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 testAfter
.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 testWhat 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 aruns-onlabel and install tools yourself. - Secure
envvars from Travis must be re-created as repository or environment secrets.
Related guides
How to Migrate From CircleCI to GitHub ActionsMove a .circleci/config.yml to GitHub Actions, mapping orbs to actions, workflows to jobs with needs, and exe…
CI Concept Mapping to GitHub ActionsA cross-tool mapping of common CI concepts (matrix, cache, artifacts, secrets, services, conditionals, manual…