forked from semantic-release/env-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (37 loc) · 1.43 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
36
37
38
39
40
41
'use strict';
const process = require('process'); // eslint-disable-line node/prefer-global/process
const git = require('./services/git');
const services = {
appveyor: require('./services/appveyor'),
bamboo: require('./services/bamboo'),
bitbucket: require('./services/bitbucket'),
bitrise: require('./services/bitrise'),
buddy: require('./services/buddy'),
buildkite: require('./services/buildkite'),
circleci: require('./services/circleci'),
cirrus: require('./services/cirrus'),
codebuild: require('./services/codebuild'),
codefresh: require('./services/codefresh'),
codeship: require('./services/codeship'),
drone: require('./services/drone'),
github: require('./services/github'),
gitlab: require('./services/gitlab'),
jenkins: require('./services/jenkins'),
puppet: require('./services/puppet'),
sail: require('./services/sail'),
scrutinizer: require('./services/scrutinizer'),
semaphore: require('./services/semaphore'),
shippable: require('./services/shippable'),
teamcity: require('./services/teamcity'),
travis: require('./services/travis'),
vsts: require('./services/vsts'),
wercker: require('./services/wercker'),
};
module.exports = ({env = process.env, cwd = process.cwd()} = {}) => {
for (const name of Object.keys(services)) {
if (services[name].detect({env, cwd})) {
return {isCi: true, ...services[name].configuration({env, cwd})};
}
}
return {isCi: Boolean(env.CI), ...git.configuration({env, cwd})};
};