# @semantic-release/condition-travis

> Check Travis CI environment before publishing

Latest version **7.1.4** (published 2017-12-31) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @semantic-release/condition-travis
pnpm add @semantic-release/condition-travis
yarn add @semantic-release/condition-travis
bun add @semantic-release/condition-travis
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 7.1.4 |
| Published | 2017-12-31 |
| First published | 2015-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Stephan Bönnemann |
| Maintainers | gr2m, christophwitzko, boennemann, semantic-release-bot |
| Keywords | publish, release, semantic-release, travis, travis-ci |

## Links

- npm: https://www.npmjs.com/package/@semantic-release/condition-travis
- Repository: https://github.com/semantic-release/condition-travis
- Homepage: https://github.com/semantic-release/condition-travis#readme
- Issues: https://github.com/semantic-release/condition-travis/issues
- npm.io page: https://npm.io/package/@semantic-release/condition-travis

## Dependencies (4)

- [github](https://npm.io/package/github.md) ^13.0.1
- [parse-github-url](https://npm.io/package/parse-github-url.md) ^1.0.1
- [travis-deploy-once](https://npm.io/package/travis-deploy-once.md) ^4.0.0
- [@semantic-release/error](https://npm.io/package/@semantic-release/error.md) ^2.0.0

## Recent versions

- 7.1.4 (latest) — 2017-12-31
- 5.0.2 (next) — 2016-11-17
- 7.1.3 — 2017-12-15
- 7.1.2 — 2017-12-13
- 7.1.1 — 2017-12-11
- 7.1.0 — 2017-12-11
- 7.0.1 — 2017-12-07
- 7.0.0 — 2017-11-25
- 6.2.1 — 2017-11-21
- 6.2.0 — 2017-11-21
- 6.1.1 — 2017-10-25
- 6.1.0 — 2017-10-02
- 6.0.3 — 2017-09-25
- 6.0.2 — 2017-09-21
- 6.0.1 — 2017-09-19
- … 12 more at https://npm.io/package/@semantic-release/condition-travis/versions

## README

# @semantic-release/condition-travis

[semantic-release](https://github.com/semantic-release/semantic-release) plugin to check [Travis CI](https://travis-ci.org/) environment before publishing.

[![Travis](https://img.shields.io/travis/semantic-release/condition-travis.svg)](https://travis-ci.org/semantic-release/condition-travis)
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/condition-travis.svg)](https://codecov.io/gh/semantic-release/condition-travis)
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/condition-travis.svg)](https://greenkeeper.io/)

Verify that `semantic-release` is running:
-   on Travis CI
-   on the right git branch and not on a PR build
-   only after all other Travis jobs are successful (using [travis-deploy-once](https://github.com/semantic-release/travis-deploy-once))

### Options

| Option                | Description                                                          | Default                                                |
| --------------------- | -------------------------------------------------------------------- | ------------------------------------------------------ |
| `githubToken`         | **Required.** The Github token used to authenticate with Travis API. | `process.env.GH_TOKEN` or `process.env.GITHUB_TOKEN`   |
| `githubUrl`           | The GitHub Enterprise endpoint.                                      | `process.env.GH_URL` or `process.env.GITHUB_URL`       |
| `githubApiPathPrefix` | The GitHub Enterprise API prefix.                                    | `process.env.GH_PREFIX` or `process.env.GITHUB_PREFIX` |
| `travisUrl`           | The Travis Enterprise endpoint.                                      | `process.env.TRAVIS_URL`                               |

## Configuration

The plugin is used by default by [semantic-release](https://github.com/semantic-release/semantic-release) so no specific configuration is required if `githubToken`, `githubUrl`, `githubApiPathPrefix` and `travisUrl` are set via environment variable.

## Travis configuration

`semantic-release` require Node node version >= 8, so at least one Travis job as to run on Node 8 (or greater).

### With one job 

No specific configuration is required. `semantic-release` will run on the only Travis job.

```yml
language: node_js
node_js:
  - 8

after_success:
  - npm run semantic-release
```

### With multiple jobs on different Node versions and OS

If there are multiple Node versions and OSs configured, [travis-deploy-once](https://github.com/semantic-release/travis-deploy-once) will guarantee that `semantic-release` is executed on the highest Node version, after all other jobs are successful, without any additional configurations.

```yml
language: node_js
node_js:
  - 8
  - 6
  - 4
os:
  - linux
  - osx

after_success:
  - npm run semantic-release
```

In this example Travis will run 6 jobs (Node 8/Linux, Node 8/ OSX, Node 6/Linux etc...) and `semantic-release` will be executed on Node 8 on Linux, only after the 5 other jobs are successful.

### Using Travis Build stages

Travis support [Build Stages](https://docs.travis-ci.com/user/build-stages/) for more complex workflows. It's possible to use `semantic-release` with Build Stages by configuring the environment variable `BUILD_LEADER_ID` to defined which job will run `semantic-release`.

**The build stage configuration has to guarantee that the job configured with `BUILD_LEADER_ID` will run only after all other jobs are successful.**
 
```yml
language: node_js
node_js:
  - 8
  - 6
  - 4
os:
  - linux
  - osx
env:
  - BUILD_LEADER_ID=7
jobs:
  include:
    - stage: release
      node_js: 8
      os: linux
      after_success: 
        - npm run semantic-release
```

In this example Travis will run 6 jobs in the default stage (Node 4, 6 and 8 on Linux and OSX) and if those 6 jobs are successful the release stage will run the 7th job (on Node 8 / Linux) that will execute `semantic-release`.
The environment variable `BUILD_LEADER_ID` is set to `7` as `semantic-release` should run on the 7th job.

---
_Source: https://npm.io/package/@semantic-release/condition-travis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
