-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ci): trying to work around travis jobs problems in semantic release
- Loading branch information
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function validTravis(pluginConfig, config) { | ||
var env = config.env; | ||
var options = config.options; | ||
return env.TRAVIS === 'true' && | ||
!env.TRAVIS_TAG && | ||
options.branch === env.TRAVIS_BRANCH; | ||
} | ||
|
||
function publishFromSpecificNode(options, config, callback) { | ||
console.log('plugin options', options); | ||
|
||
function fail(message) { | ||
return callback(new Error(message)); | ||
} | ||
|
||
if (typeof options.node !== 'string') { | ||
return fail('Missing node version in the config'); | ||
} | ||
|
||
if (process.versions.node !== options.node) { | ||
return fail('Only allowed to publish from Node ' + | ||
options.node + ' not from ' + process.versions.node); | ||
} | ||
|
||
// check Travis environment for now | ||
// maybe it will be not necessary in the future | ||
// https://github.com/semantic-release/semantic-release/issues/141 | ||
if (!validTravis(options, config)) { | ||
return fail('Travis is invalid'); | ||
} | ||
|
||
callback(new Error('nope'), null); | ||
} | ||
|
||
module.exports = publishFromSpecificNode; |