forked from semantic-release/env-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (32 loc) · 1.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const process = require('process');
const git = require('./lib/git');
const services = {
appveyor: require('./lib/appveyor'),
bamboo: require('./lib/bamboo'),
bitbucket: require('./lib/bitbucket'),
bitrise: require('./lib/bitrise'),
buddy: require('./lib/buddy'),
buildkite: require('./lib/buildkite'),
circleci: require('./lib/circleci'),
cirrus: require('./lib/cirrus'),
codebuild: require('./lib/codebuild'),
codeship: require('./lib/codeship'),
drone: require('./lib/drone'),
gitlab: require('./lib/gitlab'),
jenkins: require('./lib/jenkins'),
semaphore: require('./lib/semaphore'),
shippable: require('./lib/shippable'),
teamcity: require('./lib/teamcity'),
travis: require('./lib/travis'),
vsts: require('./lib/vsts'),
wercker: require('./lib/wercker'),
};
module.exports = ({env = process.env, cwd = process.cwd()} = {}) => {
for (const name of Object.keys(services)) {
if (services[name].detect({env, cwd})) {
return Object.assign({isCi: true}, services[name].configuration({env, cwd}));
}
}
return Object.assign({isCi: Boolean(env.CI)}, git.configuration({env, cwd}));
};