Compare commits

...
27 Commits
Author SHA1 Message Date
Kaito UdagawaandGregor Martynus 3f8559731f fix(post): Create a tag before makeing a release 2017-08-13 20:29:49 -07:00
Kaito UdagawaandGregor Martynus f148a61339 fix(post): fix target_commitish to be the default branch
target_commitish in GitHub Releases has two different meanings:
* Target commit that a new associated tag will be created on
* Target branch to compute how many "commits to since this release"

target_commitish is usually the default branch (aka master), because the
distance between the release and the latest branch is the primary concern.

Before this change, target_commitish was left to be a hash and the
feature of GitHub Releases that shows how much time passed since the
release is ruined, because no tracking branch is given.

By this change, target_commitish is changed to be the default branch
given in the configuration (options.branch) via edit a release API after
the release and tag are created via crate a release API.
2017-08-13 20:29:49 -07:00
Gregor 5b3bdd226f chore: remove console.log 2017-08-13 12:10:36 -07:00
Gregor 64d84a0e84 chore(travis): drop builds in Node <4 2017-08-13 12:10:36 -07:00
greenkeeper[bot]andGregor Martynus 1fa6d50264 fix(package): update @semantic-release/release-notes-generator to version 3.0.1
BREAKING CHANGE: Dropped support for unmaintained Node.js versions (< v4)
2017-08-13 12:10:36 -07:00
Jan Peer StöcklmairandGregor Martynus 6145bc9ba5 docs(readme): add sgc (#386) 2017-08-12 15:59:01 -07:00
Piper ChesterandGregor Martynus 609b46f1cf docs(README): minor typo (#376) 2017-06-12 13:41:42 +02:00
greenkeeper[bot]andStephan Bönnemann 76cd99c3a5 chore(package): update standard to version 9.0.0
https://greenkeeper.io/
2017-03-06 10:13:19 +01:00
greenkeeper[bot]andStephan Bönnemann 22dc640117 chore(package): update tap to version 10.0.1
https://greenkeeper.io/
2017-02-03 11:37:47 +01:00
Stephan BönnemannandGitHub af90de989e Merge pull request #355 from semantic-release/dep-updates
Misc GK dep updates
2017-01-13 12:13:30 +01:00
Stephan Bönnemann aa012b3023 Merge branch 'greenkeeper/tap-9.0.0' into dep-updates
* greenkeeper/tap-9.0.0:
  chore(package): update tap to version 9.0.0
2017-01-13 12:04:45 +01:00
Stephan Bönnemann 5724b19e23 Merge branch 'greenkeeper/github-8.0.0' into dep-updates
* greenkeeper/github-8.0.0:
  fix(package): update github to version 8.0.0
2017-01-13 12:04:25 +01:00
Stephan BönnemannandGitHub 97a8e73b01 Merge branch 'caribou' into greenkeeper/nopt-4.0.0 2017-01-13 11:51:22 +01:00
Cory ReedandStephan Bönnemann 51e12a3a4b docs(package): fix 'home' link 2017-01-13 11:51:04 +01:00
greenkeeper[bot] afd6ab754d fix(package): update github to version 8.0.0
https://greenkeeper.io/
2017-01-11 17:54:30 +00:00
greenkeeper[bot] f80e056e13 chore(package): update tap to version 9.0.0
https://greenkeeper.io/
2017-01-08 07:14:51 +00:00
greenkeeper[bot] b10c8910fb fix(package): update nopt to version 4.0.0
https://greenkeeper.io/
2016-12-13 23:38:46 +00:00
greenkeeper[bot]andChristoph Witzko 3295f9570c fix(package): update github to version 7.0.0
https://greenkeeper.io/
2016-12-02 12:33:58 +01:00
Ryan KimberandChristoph Witzko 6a172e1720 docs(README.md): discourage use of pre-patch, pre-minor and pre-release 2016-11-28 17:20:18 +01:00
greenkeeper[bot]andChristoph Witzko 68f975382d chore(package): update dependencies
https://greenkeeper.io/
2016-11-28 16:55:34 +01:00
Christoph Witzko 462c51dc2a style: standard 2016-11-28 16:37:00 +01:00
Christoph Witzko cdf705cb8a chore: update dependencies 2016-11-28 16:37:00 +01:00
Christoph Witzko 9a51b0271d chore: update github client 2016-11-28 16:36:53 +01:00
develarandChristoph Witzko 14618c81c9 chore(package): parse-github-repo-url 2016-11-28 16:14:43 +01:00
develarandChristoph Witzko 35da08d074 test: fix "/bin/bash: NO_PROMPT=yes: command not found" 2016-11-28 16:14:43 +01:00
Ben GummerandStephan Bönnemann 73138f8a8f fix: use spawn instead of exec for 'git log' to avoid maxBuffer err 2016-11-28 15:50:59 +01:00
Mark DalgleishandChristoph Witzko d7f5d19073 docs(readme): fix link to how the CLI works 2016-11-28 11:34:33 +01:00
12 changed files with 103 additions and 66 deletions
+7 -8
View File
@@ -2,17 +2,13 @@ sudo: false
language: node_js
cache:
directories:
- node_modules
- $HOME/.npm
notifications:
email: false
node_js:
- 5
- 4
- iojs
- '0.12'
- '0.10'
before_install:
- npm i -g npm@^2.0.0
- 8 # stable
- 6 # LTS
- 4 # maintenance
before_script:
- npm prune
after_success:
@@ -20,3 +16,6 @@ after_success:
- npm run semantic-release
services:
- couchdb
branches:
except:
- /^v\d+\.\d+\.\d+$/
+8 -4
View File
@@ -79,7 +79,7 @@ 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` 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/).
When `semantic-release` is set up 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.
@@ -106,7 +106,7 @@ format that includes a **type**, a **scope** and a **subject** ([full explanatio
<footer>
```
You can simplify using this convention for yourself and contributors by using [commitizen](https://github.com/commitizen/cz-cli) and [validate-commit-msg](https://github.com/kentcdodds/validate-commit-msg).
You can simplify using this convention for yourself and contributors by using [commitizen](https://github.com/commitizen/cz-cli) and [validate-commit-msg](https://github.com/kentcdodds/validate-commit-msg) or [semantic-git-commit-cli](https://github.com/JPeer264/node-semantic-git-commit-cli).
### Patch Release
@@ -141,7 +141,7 @@ semantic-release-cli setup
![dialogue](https://cloud.githubusercontent.com/assets/908178/9428123/3628dfec-499f-11e5-8bdd-8f3042dd95ed.png)
_[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`
+3 -3
View File
@@ -99,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
}
+16 -15
View File
@@ -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.2",
"@semantic-release/error": "^1.0.0",
"@semantic-release/last-release-npm": "^1.2.1",
"@semantic-release/release-notes-generator": "^2.0.0",
"@semantic-release/release-notes-generator": "^3.0.1",
"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": "^4.0.0",
"parse-github-repo-url": "^1.3.0",
"require-relative": "^0.8.7",
"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": "^8.0.0",
"npm-registry-couchapp": "^2.6.11",
"nyc": "^7.0.0",
"nock": "^9.0.2",
"npm-registry-couchapp": "^2.6.12",
"nyc": "^10.0.0",
"proxyquire": "^1.7.3",
"rimraf": "^2.5.0",
"standard": "^7.0.1",
"tap": "^6.2.0"
"standard": "^9.0.0",
"tap": "^10.0.1"
},
"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 -14
View File
@@ -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 --no-color --contains ' + from, function (err, stdout) {
childProcess.exec('git branch --no-color --contains ' + from, function (err, stdout) {
var inHistory = false
var branches
@@ -47,28 +47,33 @@ module.exports = function (config, cb) {
})
function extract () {
exec(
'git log -E --format=%H==SPLIT==%B==END== ' + range,
{
maxBuffer: 1024 * 1024 // 1MB instead of 220KB (issue #286)
},
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]
}
}))
}
)
})
)
})
}
}
+24 -7
View File
@@ -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,
@@ -25,12 +24,18 @@ module.exports = function (config, cb) {
if (err) return cb(err)
var ghRepo = parseSlug(pkg.repository.url)
var tag = {
owner: ghRepo[0],
repo: ghRepo[1],
ref: 'refs/heads/v' + pkg.version,
sha: hash
}
var release = {
owner: ghRepo[0],
repo: ghRepo[1],
name: 'v' + pkg.version,
tag_name: 'v' + pkg.version,
target_commitish: hash,
name: 'v' + pkg.version,
target_commitish: options.branch,
draft: !!options.debug,
body: log
}
@@ -40,14 +45,26 @@ module.exports = function (config, cb) {
}
github.authenticate({
type: 'oauth',
type: 'token',
token: options.githubToken
})
github.releases.createRelease(release, function (err) {
if (options.debug) {
return github.repos.createRelease(release, function (err) {
if (err) return cb(err)
cb(null, true, release)
})
}
github.gitdata.createReference(tag, function (err) {
if (err) return cb(err)
cb(null, true, release)
github.repos.createRelease(release, function (err) {
if (err) return cb(err)
cb(null, true, release)
})
})
})
})
+1 -1
View File
@@ -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)
+13 -7
View File
@@ -1,3 +1,15 @@
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'
@@ -12,13 +24,7 @@ module.exports = {
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
}
+6 -1
View File
@@ -3,7 +3,12 @@ module.exports = function () {
authenticate: function () {
return true
},
releases: {
gitdata: {
createReference: function (release, cb) {
cb(null)
}
},
repos: {
createRelease: function (release, cb) {
cb(null)
}
+2 -1
View File
@@ -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
+4 -4
View File
@@ -23,14 +23,14 @@ var defaultRelease = {
repo: 'up',
name: 'v1.0.0',
tag_name: 'v1.0.0',
target_commitish: 'bar',
target_commitish: 'master',
body: 'the log'
}
test('full post run', function (t) {
t.test('in debug mode w/o token', function (tt) {
post({
options: {debug: true},
options: {debug: true, branch: 'master'},
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
@@ -44,7 +44,7 @@ test('full post run', function (t) {
t.test('in debug mode w/token', function (tt) {
post({
options: {debug: true, githubToken: 'yo'},
options: {debug: true, githubToken: 'yo', branch: 'master'},
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
@@ -58,7 +58,7 @@ test('full post run', function (t) {
t.test('production', function (tt) {
post({
options: {githubToken: 'yo'},
options: {githubToken: 'yo', branch: 'master'},
pkg: pkg,
plugins: plugins
}, function (err, published, release) {
-1
View File
@@ -39,7 +39,6 @@ test('verify pkg, options and env', function (t) {
}
})
console.log(noErrors)
tt.is(noErrors.length, 0)
tt.end()
})