-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
47 lines (41 loc) · 1.34 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module.exports = function(grunt) {
grunt.initConfig({
bump: {
options: {
files: ['package.json', 'package.js'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'upstream',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: true,
prereleaseName: false,
regExp: false
}
}
});
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('default', 'release');
grunt.registerTask('release', 'Release a new version', function () {
var files = ['ol3.fetch.json', 'README.md'];
var newVer = grunt.option('ver');
var oldVer = grunt.file.readJSON('package.json').version;
if (!newVer) {
grunt.log("please specify the --ver=<version> option");
return false;
}
//update the version in the download links and readme file
grunt.log.writeln("About to release version %s (up from %s)", newVer, oldVer);
files.forEach(function (fileName) {
var content = grunt.file.read(fileName);
grunt.file.write(fileName, content.split(oldVer).join(newVer));
});
grunt.option('setversion', newVer);
grunt.task.run('bump');
});
};