forked from geddski/grunt-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
138 lines (129 loc) · 3.31 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
clean: {
test: 'test/fixtures/_*.{json,md}'
},
nodeunit: {
tests: 'test/release_test.js'
},
release: {
options: {
bump: true,
file: 'package.json',
changelog: 'CHANGELOG.md',
changelogText: '### <%= version %> - ' + grunt.template.today('yyyy-mm-dd') + '\n',
commitMessage: 'v<%= version %>',
add: true,
commit: true,
tag: true,
push: true,
pushTags: true,
npm: true,
npmtag: false,
github: {
repo: 'geddski/grunt-release',
accessTokenVar: 'GITHUB_ACCESS_TOKEN'
}
}
},
releaseTest: {
options: {
bump: true,
add: false,
commit: false,
tag: false,
push: false,
pushTags: false,
npm: false,
npmtag: false,
github: false
},
general: {
options: {
file: 'test/fixtures/_component.json',
changelog: 'test/fixtures/_CHANGELOG.md',
additionalFiles: ['test/fixtures/_bower.json'],
changelogText: '### <%= version %>\n',
commitMessage: 'v<%= version %>'
}
},
absolute: {
args: ['1.2.3'],
options: {
file: 'test/fixtures/_bower-absolute.json'
}
},
patch: {
args: ['patch'],
options: {
file: 'test/fixtures/_component-patch.json'
}
},
minor: {
args: ['minor'],
options: {
file: 'test/fixtures/_component-minor.json'
}
},
major: {
args: ['major'],
options: {
file: 'test/fixtures/_component-major.json'
}
}
},
setup: {
test: {
files: [{
src: 'test/fixtures/component.json',
dest: 'test/fixtures/_component.json'
},{
src: 'test/fixtures/bower.json',
dest: 'test/fixtures/_bower.json'
},{
src: 'test/fixtures/CHANGELOG.md',
dest: 'test/fixtures/_CHANGELOG.md'
},{
src: 'test/fixtures/bower.json',
dest: 'test/fixtures/_bower-absolute.json'
},{
src: 'test/fixtures/component.json',
dest: 'test/fixtures/_component-patch.json'
},{
src: 'test/fixtures/component.json',
dest: 'test/fixtures/_component-minor.json'
},{
src: 'test/fixtures/component.json',
dest: 'test/fixtures/_component-major.json'
}]
}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.registerTask('test', [
'clean',
'setup',
'releaseTest',
'nodeunit',
'clean'
]);
grunt.registerMultiTask('setup', 'Setup test fixtures', function(){
this.files.forEach(function(f){
grunt.file.copy(f.src, f.dest);
});
});
grunt.registerMultiTask('releaseTest', function(){
var args = (this.data.args || []).join(':');
grunt.config.set('release', {});
grunt.config.merge({
release: grunt.config.data[this.name]
});
grunt.config.merge({
release: grunt.config.data[this.name][this.target]
});
grunt.task.run('release' + (args && ':' + args));
});
};