Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tagging when upgrading version #134

Merged
merged 2 commits into from
Oct 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Contributing guidelines
=======================

Contributes are more than welcome!
Contributes are more than welcome!

## Troubleshooting

Expand All @@ -15,7 +15,7 @@ When preparing a pull request, ensure all the tests pass locally running `grunt

### Publishing new version to npm

You need to be enabled for doing this.
You need to be enabled for doing this.
* `master` should be all green. If not, make it green first.
* git checkout master
* git pull
Expand All @@ -24,9 +24,7 @@ You need to be enabled for doing this.
* `grunt version:patch` for bugfixes, new features
* `grunt version:minor` for all breaking changes
* `grunt version:major` NOT YET. Still need to define milestones for 1.0.0.
* git add .
* git commit -m "\<new version\>"
* git push
* git push --follow-tags
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matteofigus I've updated to above git command (which should:
Push all the refs that would be pushed without this option, and also push annotated tags in refs/tags that are missing from the remote but are pointing at commit-ish that are reachable from the refs being pushed) which seems to be more accurate (than pushing twice).
Don't know if it makes sense now to move it to the grunt task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

* [sudo] npm publish .

## Code of Conduct
Expand Down
11 changes: 7 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = function(grunt) {
grunt.registerTask('test-local-silent', ['jshint:all', 'mochaTest:silent', 'karma:local']);
grunt.registerTask('test', ['jshint:all', 'mochaTest:unit', 'mochaTest:acceptance', 'sauce']);
grunt.registerTask('test-windows', ['jshint:all', 'mochaTest:unit', 'mochaTest:acceptance']);
grunt.registerTask('git-stage', ['gitadd', 'gitcommit:version', 'gittag:addtag']);

// custom tasks
grunt.registerTask('build', 'Builds and minifies the oc-client component', function(){
Expand Down Expand Up @@ -65,18 +66,19 @@ module.exports = function(grunt) {
});

grunt.registerTask('generate-cli-doc', 'Automatically updates the cli.md file', function(){

var parsed = commandsParser.parse(),
data = fs.readFileSync('./grunt-tasks/support/cli-template.md', 'utf8'),
newFileData = data.replace('[commands-shortlist]', parsed.commandList).replace('[commands-detailed]', parsed.detailedCommandList);

fs.writeFileSync('./docs/cli.md', newFileData);
});

// used for version patching
grunt.registerTask('version', 'Does the version upgrade', function(versionType){

taskObject.pkg.version = semver.inc(taskObject.pkg.version, versionType);
grunt.config.set('version', taskObject.pkg.version);

grunt.log.ok('Package version upgrading to: ' + taskObject.pkg.version);

Expand All @@ -85,7 +87,8 @@ module.exports = function(grunt) {
grunt.task.run([
'test-local-silent',
'generate-cli-doc',
'build'
'build',
'git-stage'
]);
});
};
7 changes: 7 additions & 0 deletions grunt-tasks/gitadd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
files: {
src: ['.']
}
};
12 changes: 12 additions & 0 deletions grunt-tasks/gitcommit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
version: {
options: {
message: '<%= version %>'
},
files: {
src: ['.']
}
}
};
11 changes: 11 additions & 0 deletions grunt-tasks/gittag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

module.exports = {
addtag: {
options: {
tag: 'v<%= version %>',
message: 'Package version upgrade to: <%= version %>',
annotated: true
}
}
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"cheerio": "0.18.0",
"grunt": "0.4.5",
"grunt-contrib-jshint": "0.10.0",
"grunt-git": "0.3.5",
"grunt-karma": "0.10.1",
"grunt-mocha-test": "0.12.7",
"injectr": "0.5.1",
Expand Down