Skip to content

Travis CI

The following config declares the deploy job that run on all branches. The job will either release:

  • a new latest version from baseBranch
  • a canary build from a pull request (if your package manager plugin implements them)

.travis.yml

language: node_js
node_js: "10"

git:
  depth: false

script:
  - yarn lint
  - yarn test
  - yarn build

deploy:
  - provider: script
    script: if [ "$GH_TOKEN" != "false" ];then npx auto shipit; fi;
    skip-cleanup: true
    on:
      all_branches: true
language: node_js
node_js: "10"

git:
  depth: false

script:
  - yarn lint
  - yarn test
  - yarn build

deploy:
  - provider: script
    script: if [ "$GH_TOKEN" != "false" ];then npx auto shipit; fi;
    skip-cleanup: true
    on:
      all_branches: true

Troubleshooting

If you are having problems make sure you have done the following:

  • GH_TOKEN is set
  • Any other secrets for plugins are set (Ex; NPM_TOKEN with the NPM plugin)

Detached Head (Monorepo)

Some plugins might use tools that require you to be on a branch. The default setup for travis leaves you in a "Detached Head" state, meaning the git HEAD pointer is not on a branch. To fix this add the following lines to your .travis.yml

before_deploy:
  - if [ "$TRAVIS_BRANCH" == "main" ];then
    git checkout main;
    fi;
before_deploy:
  - if [ "$TRAVIS_BRANCH" == "main" ];then
    git checkout main;
    fi;

This code will ensure that your git HEAD is on baseBranch when creating a new release.

Canary Deploy Failing on Forks

By default Travis will not pass secrets to forks. Because of this canaries releases will fail. You can either:

  • Pass secrets to forks (insecure)
  • Only run shipit if secrets are available (recommended, in above config)

Examples