Skip to content

Commit

Permalink
feat: allow defer-release keyword in commit messages (#161)
Browse files Browse the repository at this point in the history
* feat: allow defer-release keyword in commit messages

* fix: halt release process with exit code 0 when defer

* refactor(release): allow space or dash in tag
  • Loading branch information
varl authored Oct 16, 2019
1 parent 08c6ff1 commit ef6b385
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/utils/src/cmds/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ const handler = async ({ publish }) => {
},
]

const deferPlugin = require('../support/semantic-release-defer-release')

// Order matters here!
const plugins = [
deferPlugin,
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
updateDepsPlugin,
Expand Down
16 changes: 16 additions & 0 deletions packages/utils/src/support/semantic-release-defer-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const SemanticReleaseError = require('@semantic-release/error')

const analyzeCommits = (config = {}, context) => {
const { logger, commits } = context

const { message, commit } = commits[0]
const defer = /\[defer[ -]release\]/gi

if (message.match(defer)) {
logger.warn(`This release has been deferred by commit ${commit.short}`)
logger.complete('Halting release process...')
process.exit(0)
}
}

module.exports = { analyzeCommits }

0 comments on commit ef6b385

Please sign in to comment.