Travis CI

Environment variables

The Authentication environment variables can be configured in Travis Repository Settings or with the travis env set CLI.
Alternatively, the default NPM_TOKEN and GH_TOKEN can be easily setup with semantic-release-cli.

Node.js projects configuration

.travis.yml configuration for multiple Node.js jobs

This example is a minimal configuration for semantic-release with a build running Node 14 and 16. See Travis - Customizing the Build for additional configuration options.
It's recommended to run the semantic-release command in the Travis deploy step so if an error occurs the build will fail and Travis will send a notification.
Note: It's not recommended to run the semantic-release command in the Travis script step as each script in this step will be executed regardless of the outcome of the previous one. See travis-ci/travis-ci#1066.
Advanced configuration: Running the tests in the script step of the release stage is not necessary as the previous stage(s) already ran them. To increase speed, the script step of the release stage can be overwritten to skip the tests. Note that other commands such as build or compilation might still be required.
1
language: node_js
2
​
3
node_js:
4
- 14
5
- 16
6
​
7
jobs:
8
include:
9
# Define the release stage that runs semantic-release
10
- stage: release
11
node_js: lts/*
12
# Advanced: optionally overwrite your default `script` step to skip the tests
13
# script: skip
14
deploy:
15
provider: script
16
skip_cleanup: true
17
script:
18
- npx semantic-release
Copied!

package.json configuration for multiple Node jobs

A package.json is required only for local semantic-release installation.
1
{
2
"devDependencies": {
3
"semantic-release": "^18.0.0"
4
}
5
}
Copied!

Non-Node.js projects configuration

For projects that require to be tested with one or multiple version of a Non-JavaScript language, optionally on multiple Operating Systems.
This recipe cover the Travis specifics only. See Non JavaScript projects recipe for more information on the semantic-release configuration.

.travis.yml configuration for non-JavaScript projects

This example is a minimal configuration for semantic-release with a build running Go 1.6 and 1.7. See Travis - Customizing the Build for additional configuration options.
It's recommended to run the semantic-release command in the Travis deploy step so if an error occurs the build will fail and Travis will send a notification.
Note: It's not recommended to run the semantic-release command in the Travis script step as each script in this step will be executed regardless of the outcome of the previous one. See travis-ci/travis-ci#1066.
Advanced configuration: Running the tests in the script step of the release stage is not necessary as the previous stage(s) already ran them. To increase speed, the script step of the release stage can be overwritten to skip the tests. Note that other commands such as build or compilation might still be required.
1
language: go
2
​
3
go:
4
- 1.6
5
- 1.7
6
​
7
jobs:
8
include:
9
# Define the release stage that runs semantic-release
10
- stage: release
11
# Advanced: optionally overwrite your default `script` step to skip the tests
12
# script:
13
# - make
14
deploy:
15
provider: script
16
skip_cleanup: true
17
script:
18
# Use nvm to install and use the Node LTS version (nvm is installed on all Travis images)
19
- nvm install lts/*
20
- npx semantic-release
21
on:
22
all_branches: true
Copied!
Last modified 16d ago