Publish valid semver task independently of the branch

This commit is contained in:
Nils Knappmeier
2017-05-13 00:23:17 +02:00
committed by Nils Knappmeier
parent fed5818876
commit 7378f854c3
+11 -3
View File
@@ -15,14 +15,22 @@ module.exports = function(grunt) {
git.commitInfo(function(err, info) { git.commitInfo(function(err, info) {
grunt.log.writeln('tag: ' + info.tagName); grunt.log.writeln('tag: ' + info.tagName);
if (info.isMaster) { var files = [];
initSDK();
var files = ['-latest', '-' + info.head]; // Publish the master as "latest" and with the commit-id
if (info.isMaster) {
files.push('-latest');
files.push('-' + info.head);
}
// Publish tags by their tag-name
if (info.tagName && semver.valid(info.tagName)) { if (info.tagName && semver.valid(info.tagName)) {
files.push('-' + info.tagName); files.push('-' + info.tagName);
} }
if (files.length > 0) {
initSDK();
grunt.log.writeln('publishing files: ' + JSON.stringify(files));
publish(fileMap(files), done); publish(fileMap(files), done);
} else { } else {
// Silently ignore for branches // Silently ignore for branches