Skip to content

Commit

Permalink
Fix admin tasks to use commit SHA of last release #1607
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Feb 24, 2015
1 parent 373578a commit e3f66ec
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
24 changes: 18 additions & 6 deletions tasks/admin/components/update.js
Expand Up @@ -38,7 +38,7 @@ var
version = project.version
;

module.exports = function() {
module.exports = function(callback) {

var
index = -1,
Expand All @@ -58,6 +58,7 @@ module.exports = function() {

index = index + 1;
if(index >= total) {
callback();
return;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
}
Expand All @@ -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);
}


Expand Down
22 changes: 17 additions & 5 deletions tasks/admin/distributions/update.js
Expand Up @@ -38,7 +38,7 @@ var
version = project.version
;

module.exports = function() {
module.exports = function(callback) {

var
index = -1,
Expand All @@ -58,6 +58,7 @@ module.exports = function() {

index = index + 1;
if(index >= total) {
callback();
return;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
});
Expand Down
5 changes: 3 additions & 2 deletions tasks/admin/publish.js
Expand Up @@ -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
);

};
1 change: 1 addition & 0 deletions tasks/admin/register.js
Expand Up @@ -29,6 +29,7 @@ module.exports = function(callback) {
stepRepo = function() {
index = index + 1;
if(index >= total) {
callback();
return;
}
var
Expand Down
5 changes: 3 additions & 2 deletions tasks/admin/release.js
Expand Up @@ -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
);

};
2 changes: 1 addition & 1 deletion tasks/config/admin/release.js
Expand Up @@ -60,7 +60,7 @@ module.exports = {

// components that get separate repositories for bower/npm
components : [
'accordion',
'accordion'
'ad',
'api',
'breadcrumb',
Expand Down

0 comments on commit e3f66ec

Please sign in to comment.