@makeomatic/condition-semaphore
Advanced tools
Comparing version 1.0.2 to 2.0.0
28
index.js
@@ -5,34 +5,34 @@ // docs for semaphore ENV variables | ||
const semver = require('semver') | ||
const SRError = require('@semantic-release/error') | ||
const SemanticReleaseError = require('@semantic-release/error') | ||
module.exports = function (pluginConfig, config, cb) { | ||
const env = config.env | ||
const options = config.options | ||
async function verifyConditions (pluginConfig = {}, config = {}) { | ||
const { env } = process | ||
const { options = {} } = config | ||
if (env.SEMAPHORE !== 'true') { | ||
return cb(new SRError( | ||
throw new SemanticReleaseError( | ||
'semantic-release didn’t run on Semaphore and therefore a new version won’t be published.\n' + | ||
'You can customize this behavior using "verifyConditions" plugins: git.io/sr-plugins', | ||
'ENOSEMAPHORE' | ||
)) | ||
) | ||
} | ||
if (env.hasOwnProperty('PULL_REQUEST_NUMBER')) { | ||
return cb(new SRError( | ||
throw new SemanticReleaseError( | ||
'This test run was triggered by a pull request and therefore a new version won’t be published.', | ||
'EPULLREQUEST' | ||
)) | ||
) | ||
} | ||
if (options.branch === env.BRANCH_NAME) return cb(null) | ||
if (options.branch === env.BRANCH_NAME) return null | ||
if (semver.valid(env.BRANCH_NAME)) { | ||
return cb(new SRError( | ||
throw new SemanticReleaseError( | ||
'This test run was triggered by a git tag that was created by semantic-release itself.\n' + | ||
'Everything is okay. For log output of the actual publishing process look at the build that ran before this one.', | ||
'EGITTAG' | ||
)) | ||
) | ||
} | ||
return cb(new SRError( | ||
throw new SemanticReleaseError( | ||
'This test run was triggered on the branch ' + env.BRANCH_NAME + | ||
@@ -43,3 +43,5 @@ ', while semantic-release is configured to only publish from ' + | ||
'EBRANCHMISMATCH' | ||
)) | ||
) | ||
} | ||
module.exports = { verifyConditions } |
{ | ||
"name": "@makeomatic/condition-semaphore", | ||
"version": "2.0.0", | ||
"description": "make sure only the right builds on semaphore get to publish", | ||
@@ -9,14 +10,12 @@ "author": "Vitaly Aminev <v@makeomatic.ca> (https://makeomatic.ca)", | ||
"dependencies": { | ||
"@semantic-release/error": "^1.0.0", | ||
"@semantic-release/error": "^2.1.0", | ||
"semver": "^5.1.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.2", | ||
"github-post-release": "^1.12.1", | ||
"ava": "^0.24.0", | ||
"coveralls": "^3.0.0", | ||
"nyc": "^11.0.3", | ||
"pre-git": "^3.15.0", | ||
"semantic-release": "^6.3.6", | ||
"simple-commit-message": "^3.3.1", | ||
"standard": "^10.0.2", | ||
"tap": "^10.7.0" | ||
"pre-git": "^3.17.0", | ||
"semantic-release": "^12.1.0", | ||
"standard": "^10.0.2" | ||
}, | ||
@@ -39,5 +38,15 @@ "files": [ | ||
"branch": "master", | ||
"verifyConditions": "./index.js", | ||
"analyzeCommits": "simple-commit-message", | ||
"generateNotes": "github-post-release" | ||
"verifyConditions": ["@semantic-release/npm", "@semantic-release/github"], | ||
"analyzeCommits": { | ||
"preset": "angular", | ||
"releaseRules": [ | ||
{ "type": "docs", "release": "patch" }, | ||
{ "type": "refactor", "release": "patch" }, | ||
{ "type": "style", "release": "patch" }, | ||
{ "type": "minor", "release": "minor" }, | ||
{ "type": "patch", "release": "patch" }, | ||
{ "type": "major", "release": "major" }, | ||
{ "type": "breaking", "release": "major" } | ||
] | ||
} | ||
}, | ||
@@ -52,5 +61,4 @@ "repository": { | ||
"pretest": "standard", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post", | ||
"test": "nyc tap --no-cov test.js", | ||
"commit": "simple-commit-message" | ||
"semantic-release": "semantic-release", | ||
"test": "nyc ava -v --no-cov test.js" | ||
}, | ||
@@ -66,4 +74,3 @@ "config": { | ||
} | ||
}, | ||
"version": "1.0.2" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4717
6
37
+ Added@semantic-release/error@2.2.0(transitive)
- Removed@semantic-release/error@1.0.0(transitive)