100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Travis CI Cheat Sheet

Travis CI Cheat Sheet

Reference for .travis.yml build lifecycle, language environments, stages, and deployment configuration.

1 PageBeginnerFeb 10, 2026

Basic .travis.yml

Minimal configuration for a Node.js project.

yaml
language: node_jsnode_js:  - "20"  - "18"install:  - npm ciscript:  - npm testcache:  directories:    - node_modules

Build Lifecycle Phases

Order of phases Travis CI executes per build.

  • before_install- Commands run before dependency installation (e.g. apt-get, nvm use)
  • install- Installs project dependencies
  • before_script- Setup commands run before the main script phase
  • script- Main build/test commands; a failure here fails the build
  • after_success / after_failure- Runs based on the result of the script phase
  • deploy- Deployment provider configuration triggered after a successful build

Stages & Deployment

Defining ordered stages and a deploy provider.

yaml
jobs:  include:    - stage: test      script: npm test    - stage: deploy      script: skip      deploy:        provider: pages        skip_cleanup: true        github_token: $GITHUB_TOKEN        local_dir: dist        on:          branch: main
Pro Tip

Set 'dist: jammy' (or your preferred Ubuntu release) explicitly rather than relying on the default image, since the default distribution can change and silently break builds.

Was this cheat sheet helpful?

Explore Topics

#TravisCI#TravisCICheatSheet#DevOps#Beginner#BasicTravisYml#BuildLifecyclePhases#StagesDeployment#Travis#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet