Compare commits
@@ -79,9 +79,9 @@ This removes the immediate connection between human emotions and version numbers
|
||||
|
||||
Instead of writing [meaningless commit messages](http://whatthecommit.com/), we can take our time to think about the changes in the codebase and write them down. Following formalized conventions it is then possible to generate a helpful changelog and to derive the next semantic version number from them.
|
||||
|
||||
When `semantic-release` got setup it will do that after every successful continuous integration build of your master branch (or any other branch you specify) and publish the new version for you. That way no human is directly involved in the release process and your releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org/).
|
||||
When `semantic-release` is setup it will do that after every successful continuous integration build of your master branch (or any other branch you specify) and publish the new version for you. This way no human is directly involved in the release process and your releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org/).
|
||||
|
||||
If you fear the loss of control over timing and marketing implications of software releases you should know that `semantic-release` supports [release channels](https://github.com/npm/npm/issues/2718) using `npm`’s [dist-tags](https://docs.npmjs.com/cli/dist-tag). This way you can keep control over what your users end up using by default, you can decide when to promote an automatically released version to the stable channel and you can choose which versions to write blogposts and tweets about. You can use the same mechanism to [support older versions of your software](https://gist.github.com/boennemann/54042374e49c7ade8910), for example with important security fixes.
|
||||
If you fear the loss of control over timing and marketing implications of software releases you should know that `semantic-release` supports [release channels](https://github.com/npm/npm/issues/2718) using `npm`’s [dist-tags](https://docs.npmjs.com/cli/dist-tag). This way you can keep control over what your users end up using by default, you can decide when to promote an automatically released version to the stable channel, and you can choose which versions to write blogposts and tweets about. You can use the same mechanism to [support older versions of your software](https://gist.github.com/boennemann/54042374e49c7ade8910), for example with important security fixes.
|
||||
|
||||
This is what happens in series:
|
||||
|
||||
@@ -141,7 +141,7 @@ semantic-release-cli setup
|
||||
|
||||

|
||||
|
||||
_[This is what happens under the hood.](https://github.com/semantic-release/cli#manual-setup)_
|
||||
_[This is what happens under the hood.](https://github.com/semantic-release/cli#what-it-does)_
|
||||
|
||||
## Options
|
||||
|
||||
@@ -206,7 +206,11 @@ module.exports = function (pluginConfig, config, callback) {}
|
||||
|
||||
### `analyzeCommits`
|
||||
|
||||
This plugin is responsible for determining the type of the next release. It additionally receives a `commits` array inside `config`. One commit is an object with a `message` and `hash` property. Call the callback with `'major'`, `'premajor'`, `'minor'`, `'preminor'`, `'patch'`, `'prepatch'`, `'prerelease'`, or `null` if nothing changed. Have a look at the [default implementation](https://github.com/semantic-release/commit-analyzer/).
|
||||
This plugin is responsible for determining the type of the next release. It additionally receives a `commits` array inside `config`. One commit is an object with a `message` and `hash` property. Call the callback with `'major'`, `'premajor'`, `'minor'`, `'preminor'`, `'patch'`, `'prepatch'`, `'prerelease'`, or `null` if nothing changed.
|
||||
|
||||
While it may be tempting to use `'prepatch'`, `'preminor'` & `'prerelease'` as part of a release process, this is strongly discouraged. A better approach is to use [dist-tags](https://docs.npmjs.com/cli/dist-tag) to create release channels (such as 'latest', 'next', 'stable') and to return only `'major'`, `'premajor'` and `'minor'` from the commit analyzer.
|
||||
|
||||
Have a look at the [default implementation](https://github.com/semantic-release/commit-analyzer/).
|
||||
|
||||
### `generateNotes`
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ npmconf.load({}, function (err, conf) {
|
||||
auth: {
|
||||
token: env.NPM_TOKEN
|
||||
},
|
||||
cafile: conf.get('cafile'),
|
||||
loglevel: conf.get('loglevel'),
|
||||
registry: require('../src/lib/get-registry')(pkg, conf),
|
||||
tag: (pkg.publishConfig || {}).tag || conf.get('tag') || 'latest'
|
||||
@@ -98,11 +99,11 @@ npmconf.load({}, function (err, conf) {
|
||||
if (env.NPM_OLD_TOKEN && env.NPM_EMAIL) {
|
||||
// Using the old auth token format is not considered part of the public API
|
||||
// This might go away anytime (i.e. once we have a better testing strategy)
|
||||
conf.set('_auth', '${NPM_OLD_TOKEN}', 'project')
|
||||
conf.set('email', '${NPM_EMAIL}', 'project')
|
||||
conf.set('_auth', '${NPM_OLD_TOKEN}', 'project') // eslint-disable-line no-template-curly-in-string
|
||||
conf.set('email', '${NPM_EMAIL}', 'project') // eslint-disable-line no-template-curly-in-string
|
||||
wroteNpmRc = true
|
||||
} else if (env.NPM_TOKEN) {
|
||||
conf.set(nerfDart + ':_authToken', '${NPM_TOKEN}', 'project')
|
||||
conf.set(nerfDart + ':_authToken', '${NPM_TOKEN}', 'project') // eslint-disable-line no-template-curly-in-string
|
||||
wroteNpmRc = true
|
||||
}
|
||||
|
||||
@@ -159,6 +160,6 @@ npmconf.load({}, function (err, conf) {
|
||||
log.verbose('post', (published ? 'Published' : 'Generated') + ' release notes.', release)
|
||||
})
|
||||
} else {
|
||||
log.error('post', 'Command "' + options.argv.remain[0] + '" not recognized. User either "pre" or "post"')
|
||||
log.error('post', 'Command "' + options.argv.remain[0] + '" not recognized. Use either "pre" or "post"')
|
||||
}
|
||||
})
|
||||
|
||||
+18
-17
@@ -13,43 +13,48 @@
|
||||
"path": "node_modules/cz-conventional-changelog/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bahmutov/parse-github-repo-url": "^0.1.0",
|
||||
"@semantic-release/commit-analyzer": "^2.0.0",
|
||||
"@semantic-release/condition-travis": "^5.0.0",
|
||||
"@semantic-release/condition-travis": "^5.0.2",
|
||||
"@semantic-release/error": "^1.0.0",
|
||||
"@semantic-release/last-release-npm": "^1.2.1",
|
||||
"@semantic-release/release-notes-generator": "^2.0.0",
|
||||
"git-head": "^1.2.1",
|
||||
"github": "^0.2.4",
|
||||
"github": "^8.0.0",
|
||||
"lodash": "^4.0.0",
|
||||
"nerf-dart": "^1.0.0",
|
||||
"nopt": "^3.0.3",
|
||||
"nopt": "^4.0.0",
|
||||
"normalize-package-data": "^2.3.4",
|
||||
"npmconf": "^2.1.2",
|
||||
"npmlog": "^2.0.0",
|
||||
"npmlog": "^4.0.0",
|
||||
"parse-github-repo-url": "^1.3.0",
|
||||
"require-relative": "^0.8.7",
|
||||
"run-auto": "^1.1.2",
|
||||
"run-auto": "^2.0.0",
|
||||
"run-series": "^1.1.3",
|
||||
"semver": "^5.0.3"
|
||||
"semver": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"cz-conventional-changelog": "^1.1.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mock-spawn": "^0.2.6",
|
||||
"nixt": "^0.5.0",
|
||||
"nock": "^7.0.1",
|
||||
"npm-registry-couchapp": "^2.6.11",
|
||||
"nyc": "^6.1.1",
|
||||
"nock": "^9.0.2",
|
||||
"npm-registry-couchapp": "^2.6.12",
|
||||
"nyc": "^10.0.0",
|
||||
"proxyquire": "^1.7.3",
|
||||
"rimraf": "^2.5.0",
|
||||
"standard": "^6.0.3",
|
||||
"tap": "^5.0.0"
|
||||
"standard": "^8.6.0",
|
||||
"tap": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10",
|
||||
"npm": ">=2"
|
||||
},
|
||||
"homepage": "https://github.com/semantic-release/semantic-release/tree/next#readme",
|
||||
"files": [
|
||||
"bin",
|
||||
"src"
|
||||
],
|
||||
"homepage": "https://github.com/semantic-release/semantic-release#readme",
|
||||
"keywords": [
|
||||
"author",
|
||||
"automation",
|
||||
@@ -63,10 +68,6 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "bin/semantic-release.js",
|
||||
"files": [
|
||||
"bin",
|
||||
"src"
|
||||
],
|
||||
"publishConfig": {
|
||||
"tag": "next"
|
||||
},
|
||||
|
||||
+19
-11
@@ -1,4 +1,4 @@
|
||||
var exec = require('child_process').exec
|
||||
var childProcess = require('child_process')
|
||||
|
||||
var log = require('npmlog')
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = function (config, cb) {
|
||||
|
||||
if (!from) return extract()
|
||||
|
||||
exec('git branch --contains ' + from, function (err, stdout) {
|
||||
childProcess.exec('git branch --no-color --contains ' + from, function (err, stdout) {
|
||||
var inHistory = false
|
||||
var branches
|
||||
|
||||
@@ -47,25 +47,33 @@ module.exports = function (config, cb) {
|
||||
})
|
||||
|
||||
function extract () {
|
||||
exec(
|
||||
'git log -E --format=%H==SPLIT==%B==END== ' + range,
|
||||
function (err, stdout) {
|
||||
if (err) return cb(err)
|
||||
var child = childProcess.spawn('git', ['log', '-E', '--format=%H==SPLIT==%B==END==', range])
|
||||
var stdout = ''
|
||||
var err = ''
|
||||
|
||||
cb(null, String(stdout).split('==END==\n')
|
||||
child.stdout.on('data', function (data) {
|
||||
stdout += data
|
||||
})
|
||||
|
||||
child.stderr.on('data', function (data) {
|
||||
err += data
|
||||
})
|
||||
|
||||
child.on('close', function (code) {
|
||||
if (err || code) return cb(err)
|
||||
|
||||
cb(null, String(stdout).split('==END==\n')
|
||||
.filter(function (raw) {
|
||||
return !!raw.trim()
|
||||
})
|
||||
|
||||
.map(function (raw) {
|
||||
var data = raw.split('==SPLIT==')
|
||||
return {
|
||||
hash: data[0],
|
||||
message: data[1]
|
||||
}
|
||||
}))
|
||||
}
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -2,7 +2,7 @@ var url = require('url')
|
||||
|
||||
var gitHead = require('git-head')
|
||||
var GitHubApi = require('github')
|
||||
var parseSlug = require('@bahmutov/parse-github-repo-url')
|
||||
var parseSlug = require('parse-github-repo-url')
|
||||
|
||||
module.exports = function (config, cb) {
|
||||
var pkg = config.pkg
|
||||
@@ -11,7 +11,6 @@ module.exports = function (config, cb) {
|
||||
var ghConfig = options.githubUrl ? url.parse(options.githubUrl) : {}
|
||||
|
||||
var github = new GitHubApi({
|
||||
version: '3.0.0',
|
||||
port: ghConfig.port,
|
||||
protocol: (ghConfig.protocol || '').split(':')[0] || null,
|
||||
host: ghConfig.hostname,
|
||||
@@ -40,11 +39,11 @@ module.exports = function (config, cb) {
|
||||
}
|
||||
|
||||
github.authenticate({
|
||||
type: 'oauth',
|
||||
type: 'token',
|
||||
token: options.githubToken
|
||||
})
|
||||
|
||||
github.releases.createRelease(release, function (err) {
|
||||
github.repos.createRelease(release, function (err) {
|
||||
if (err) return cb(err)
|
||||
|
||||
cb(null, true, release)
|
||||
|
||||
+2
-2
@@ -10,13 +10,13 @@ module.exports = function (config, cb) {
|
||||
|
||||
auto({
|
||||
lastRelease: plugins.getLastRelease.bind(null, config),
|
||||
commits: ['lastRelease', function (cb, results) {
|
||||
commits: ['lastRelease', function (results, cb) {
|
||||
getCommits(_.assign({
|
||||
lastRelease: results.lastRelease
|
||||
}, config),
|
||||
cb)
|
||||
}],
|
||||
type: ['commits', 'lastRelease', function (cb, results) {
|
||||
type: ['commits', 'lastRelease', function (results, cb) {
|
||||
getType(_.assign({
|
||||
commits: results.commits,
|
||||
lastRelease: results.lastRelease
|
||||
|
||||
@@ -4,7 +4,7 @@ module.exports = function (cwd, uri) {
|
||||
return nixt()
|
||||
.cwd(cwd)
|
||||
.env('NPM_OLD_TOKEN', 'aW50ZWdyYXRpb246c3VjaHNlY3VyZQ==')
|
||||
.env('NPM_EMAIL', 'integration@test.com')
|
||||
.env('NPM_EMAIL', 'integration@test.com')
|
||||
.env('GH_TOKEN', 'ghtoken')
|
||||
.env('CI', 'true')
|
||||
.env('npm_config_registry', uri)
|
||||
|
||||
@@ -1,21 +1,30 @@
|
||||
var mockSpawn = require('mock-spawn')()
|
||||
mockSpawn.setStrategy(function (command, args, opts) {
|
||||
return function (cb) {
|
||||
this.stdout.write(
|
||||
/\.\.HEAD/.test(args.join(' '))
|
||||
? rawCommits[0]
|
||||
: rawCommits.join()
|
||||
)
|
||||
cb(0)
|
||||
}
|
||||
})
|
||||
|
||||
const rawCommits = [
|
||||
'hash-one==SPLIT==commit-one==END==\n',
|
||||
'hash-two==SPLIT==commit-two==END==\n'
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
exec: function (command, cb) {
|
||||
exec: function (command, options, cb) {
|
||||
if (typeof cb === 'undefined' && typeof options === 'function') {
|
||||
cb = options
|
||||
}
|
||||
if (/contains/.test(command)) {
|
||||
if (/notinhistory/.test(command)) return cb(new Error())
|
||||
return cb(null, 'whatever\nmaster\n')
|
||||
}
|
||||
|
||||
cb(
|
||||
null,
|
||||
/\.\.HEAD/.test(command)
|
||||
? rawCommits[0]
|
||||
: rawCommits.join()
|
||||
)
|
||||
},
|
||||
spawn: mockSpawn,
|
||||
'@noCallThru': true
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ module.exports = function () {
|
||||
authenticate: function () {
|
||||
return true
|
||||
},
|
||||
releases: {
|
||||
repos: {
|
||||
createRelease: function (release, cb) {
|
||||
cb(null)
|
||||
}
|
||||
|
||||
@@ -37,4 +37,5 @@ export DEPLOY_VERSION=nope
|
||||
# setup npm-registry-couchapp
|
||||
npm explore npm-registry-couchapp -- npm start --npm-registry-couchapp:couch=$COUCH/registry
|
||||
npm explore npm-registry-couchapp -- npm run load --npm-registry-couchapp:couch=$COUCH/registry
|
||||
npm explore npm-registry-couchapp -- NO_PROMPT=yes npm run copy --npm-registry-couchapp:couch=$COUCH/registry
|
||||
export NO_PROMPT=yes
|
||||
npm explore npm-registry-couchapp -- npm run copy --npm-registry-couchapp:couch=$COUCH/registry
|
||||
|
||||
Reference in New Issue
Block a user