Skip to content
This repository was archived by the owner on Jan 14, 2018. It is now read-only.

Commit 61541a8

Browse files
committed
feat: initial
1 parent 7f2781e commit 61541a8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const SRError = require('@semantic-release/error')
2+
3+
module.exports = function (options, pkg, argv, env, cb) {
4+
if (!env.TRAVIS) return cb(new SRError('Not running on Travis', 'ENOTRAVIS'))
5+
6+
if (env.TRAVIS_PULL_REQUEST) return cb(new SRError('Not publishing from pull requests', 'EPULLREQUEST'))
7+
if (env.TRAVIS_TAG) return cb(new SRError('Not publishing from tags', 'EGITTAG'))
8+
9+
const branch = (pkg.release || {}).branch || 'master'
10+
11+
if (branch !== env.TRAVIS_BRANCH) return cb(new SRError(`Branch is not ${branch}`, 'EBRANCHMISMATCH'))
12+
13+
if (env.hasOwnProperty('BUILD_LEADER')) {
14+
if (env.BUILD_LEADER !== 'YES') return cb(new SRError('Not publishing from minion', 'ENOBUILDLEADER'))
15+
if (env.BUILD_AGGREGATE_STATUS !== 'others_succeeded') return cb(new SRError('Not publishing when other jobs in the build matrix fail.', 'EOTHERSFAILED'))
16+
}
17+
18+
cb(null)
19+
}

0 commit comments

Comments
 (0)