Browse Source

Fix admin tasks to use commit SHA of last release #1607

pull/1875/head
jlukic 10 years ago
parent
commit
e3f66ec2a0
6 changed files with 43 additions and 16 deletions
  1. 24
      tasks/admin/components/update.js
  2. 22
      tasks/admin/distributions/update.js
  3. 5
      tasks/admin/publish.js
  4. 1
      tasks/admin/register.js
  5. 5
      tasks/admin/release.js
  6. 2
      tasks/config/admin/release.js

24
tasks/admin/components/update.js

@ -38,7 +38,7 @@ var
version = project.version version = project.version
; ;
module.exports = function() {
module.exports = function(callback) {
var var
index = -1, index = -1,
@ -58,6 +58,7 @@ module.exports = function() {
index = index + 1; index = index + 1;
if(index >= total) { if(index >= total) {
callback();
return; return;
} }
@ -91,6 +92,7 @@ module.exports = function() {
fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory }, fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory },
usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory }, usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory },
emailOptions = { args : 'config user.email "' + oAuth.email + '"', 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')), localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')),
canProceed = true canProceed = true
@ -132,19 +134,29 @@ module.exports = function() {
; ;
} }
// push changess to remote
// push changes to remote
function pushFiles() { function pushFiles() {
console.info('Pushing files for ' + component); console.info('Pushing files for ' + component);
git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) {
console.info('Push completed successfully'); 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 // create release on GitHub.com
function createRelease() {
function createRelease(version) {
console.log('Tagging release as ', version); console.log('Tagging release as ', version);
github.releases.createRelease(releaseOptions, function() {
if(version) {
releaseOptions.target_commitish = version;
}
github.releases.editRelease(releaseOptions, function() {
nextRepo(); nextRepo();
}); });
} }
@ -154,7 +166,7 @@ module.exports = function() {
console.log('Sleeping for 1 second...'); console.log('Sleeping for 1 second...');
// avoid rate throttling // avoid rate throttling
global.clearTimeout(timer); global.clearTimeout(timer);
timer = global.setTimeout(stepRepo, 1000);
timer = global.setTimeout(stepRepo, 500);
} }

22
tasks/admin/distributions/update.js

@ -38,7 +38,7 @@ var
version = project.version version = project.version
; ;
module.exports = function() {
module.exports = function(callback) {
var var
index = -1, index = -1,
@ -58,6 +58,7 @@ module.exports = function() {
index = index + 1; index = index + 1;
if(index >= total) { if(index >= total) {
callback();
return; return;
} }
@ -90,6 +91,7 @@ module.exports = function() {
fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory }, fileModeOptions = { args : 'config core.fileMode false', cwd: outputDirectory },
usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory }, usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory },
emailOptions = { args : 'config user.email "' + oAuth.email + '"', 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')), localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')),
canProceed = true canProceed = true
@ -130,18 +132,28 @@ module.exports = function() {
; ;
} }
// push changess to remote
// push changes to remote
function pushFiles() { function pushFiles() {
console.info('Pushing files for ' + distribution);
console.info('Pushing files for ' + component);
git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) {
console.info('Push completed successfully'); 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 // create release on GitHub.com
function createRelease() {
function createRelease(version) {
console.log('Tagging release as ', version); console.log('Tagging release as ', version);
if(version) {
releaseOptions.target_commitish = version;
}
github.releases.createRelease(releaseOptions, function() { github.releases.createRelease(releaseOptions, function() {
nextRepo(); nextRepo();
}); });

5
tasks/admin/publish.js

@ -14,11 +14,12 @@ var
; ;
/* Release All */ /* Release All */
module.exports = function() {
module.exports = function(callback) {
runSequence( runSequence(
'update distributions', // commit less/css versions to github 'update distributions', // commit less/css versions to github
'update components' // commit components to github
'update components', // commit components to github
callback
); );
}; };

1
tasks/admin/register.js

@ -29,6 +29,7 @@ module.exports = function(callback) {
stepRepo = function() { stepRepo = function() {
index = index + 1; index = index + 1;
if(index >= total) { if(index >= total) {
callback();
return; return;
} }
var var

5
tasks/admin/release.js

@ -15,14 +15,15 @@ var
; ;
/* Release All */ /* Release All */
module.exports = function() {
module.exports = function(callback) {
runSequence( runSequence(
//'build', // build Semantic //'build', // build Semantic
'init distributions', // sync with current github version 'init distributions', // sync with current github version
'create distributions', // update each repo with changes from master repo 'create distributions', // update each repo with changes from master repo
'init components', // sync with current github version 'init components', // sync with current github version
'create components' // update each repo
'create components', // update each repo
callback
); );
}; };

2
tasks/config/admin/release.js

@ -60,7 +60,7 @@ module.exports = {
// components that get separate repositories for bower/npm // components that get separate repositories for bower/npm
components : [ components : [
'accordion',
'accordion'
'ad', 'ad',
'api', 'api',
'breadcrumb', 'breadcrumb',

Loading…
Cancel
Save