From e3f66ec2a0a69db2212d966a4d1c6c42d9cdd540 Mon Sep 17 00:00:00 2001 From: jlukic Date: Tue, 24 Feb 2015 11:45:39 -0500 Subject: [PATCH] Fix admin tasks to use commit SHA of last release #1607 --- tasks/admin/components/update.js | 24 ++++++++++++++++++------ tasks/admin/distributions/update.js | 22 +++++++++++++++++----- tasks/admin/publish.js | 5 +++-- tasks/admin/register.js | 1 + tasks/admin/release.js | 5 +++-- tasks/config/admin/release.js | 2 +- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/tasks/admin/components/update.js b/tasks/admin/components/update.js index b2ae347c1..3dac2bcee 100644 --- a/tasks/admin/components/update.js +++ b/tasks/admin/components/update.js @@ -38,7 +38,7 @@ var version = project.version ; -module.exports = function() { +module.exports = function(callback) { var index = -1, @@ -58,6 +58,7 @@ module.exports = function() { index = index + 1; if(index >= total) { + callback(); return; } @@ -91,6 +92,7 @@ module.exports = function() { fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory }, usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory }, emailOptions = { args : 'config user.email "' + oAuth.email + '"', cwd: outputDirectory }, + versionOptions = { args : 'rev-parse --verify HEAD', cwd: outputDirectory }, localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')), canProceed = true @@ -132,19 +134,29 @@ module.exports = function() { ; } - // push changess to remote + // push changes to remote function pushFiles() { console.info('Pushing files for ' + component); git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { console.info('Push completed successfully'); - createRelease(); + getSHA(); + }); + } + + // gets SHA of last commit for creating release + function getSHA() { + git.exec(versionOptions, function(error, version) { + createRelease(version.trim()); }); } // create release on GitHub.com - function createRelease() { + function createRelease(version) { console.log('Tagging release as ', version); - github.releases.createRelease(releaseOptions, function() { + if(version) { + releaseOptions.target_commitish = version; + } + github.releases.editRelease(releaseOptions, function() { nextRepo(); }); } @@ -154,7 +166,7 @@ module.exports = function() { console.log('Sleeping for 1 second...'); // avoid rate throttling global.clearTimeout(timer); - timer = global.setTimeout(stepRepo, 1000); + timer = global.setTimeout(stepRepo, 500); } diff --git a/tasks/admin/distributions/update.js b/tasks/admin/distributions/update.js index 8f5f6c962..2a5e49ebf 100644 --- a/tasks/admin/distributions/update.js +++ b/tasks/admin/distributions/update.js @@ -38,7 +38,7 @@ var version = project.version ; -module.exports = function() { +module.exports = function(callback) { var index = -1, @@ -58,6 +58,7 @@ module.exports = function() { index = index + 1; if(index >= total) { + callback(); return; } @@ -90,6 +91,7 @@ module.exports = function() { fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory }, usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory }, emailOptions = { args : 'config user.email "' + oAuth.email + '"', cwd: outputDirectory }, + versionOptions = { args : 'rev-parse --verify HEAD', cwd: outputDirectory }, localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')), canProceed = true @@ -130,18 +132,28 @@ module.exports = function() { ; } - // push changess to remote + // push changes to remote function pushFiles() { - console.info('Pushing files for ' + distribution); + console.info('Pushing files for ' + component); git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { console.info('Push completed successfully'); - createRelease(); + getSHA(); + }); + } + + // gets SHA of last commit for creating release + function getSHA() { + git.exec(versionOptions, function(error, version) { + createRelease(version); }); } // create release on GitHub.com - function createRelease() { + function createRelease(version) { console.log('Tagging release as ', version); + if(version) { + releaseOptions.target_commitish = version; + } github.releases.createRelease(releaseOptions, function() { nextRepo(); }); diff --git a/tasks/admin/publish.js b/tasks/admin/publish.js index 2e196f9a0..e80c86a50 100644 --- a/tasks/admin/publish.js +++ b/tasks/admin/publish.js @@ -14,11 +14,12 @@ var ; /* Release All */ -module.exports = function() { +module.exports = function(callback) { runSequence( 'update distributions', // commit less/css versions to github - 'update components' // commit components to github + 'update components', // commit components to github + callback ); }; \ No newline at end of file diff --git a/tasks/admin/register.js b/tasks/admin/register.js index 70f4411e3..dc604ec17 100644 --- a/tasks/admin/register.js +++ b/tasks/admin/register.js @@ -29,6 +29,7 @@ module.exports = function(callback) { stepRepo = function() { index = index + 1; if(index >= total) { + callback(); return; } var diff --git a/tasks/admin/release.js b/tasks/admin/release.js index 0eade99d1..a247e8bfa 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -15,14 +15,15 @@ var ; /* Release All */ -module.exports = function() { +module.exports = function(callback) { runSequence( //'build', // build Semantic 'init distributions', // sync with current github version 'create distributions', // update each repo with changes from master repo 'init components', // sync with current github version - 'create components' // update each repo + 'create components', // update each repo + callback ); }; \ No newline at end of file diff --git a/tasks/config/admin/release.js b/tasks/config/admin/release.js index 7b8cb18b4..ebfa09019 100644 --- a/tasks/config/admin/release.js +++ b/tasks/config/admin/release.js @@ -60,7 +60,7 @@ module.exports = { // components that get separate repositories for bower/npm components : [ - 'accordion', + 'accordion' 'ad', 'api', 'breadcrumb',