Skip to content

Commit

Permalink
progress on automated github releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Aug 19, 2014
1 parent 91fde35 commit 86bada0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packaging/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function github() {

promiseify(g.authorization, 'create');
promiseify(g.user, 'get');

promiseify(g.releases, 'listReleases');
promiseify(g.releases, 'createRelease');
promiseify(g.releases, 'uploadAsset');
return g;
}

Expand Down
46 changes: 46 additions & 0 deletions packaging/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,47 @@ function libraryStep(program){
}
}

function releaseStep(program, github) {
if (program.norelease) {
console.log("Skipping github release creation");
return RSVP.Promise.cast();
} else {
return github.releases.createRelease({
tag_name: 'v' + version(),
target_commitish: 'master',
owner: 'ef4',
repo: 'liquid-fire',
draft: true
}).then(function(){
console.log("Created github release");
});
}
}

function assetUploadStep(program, github) {
if (program.noupload) {
console.log("Skipping github release asset upload");
return RSVP.Promise.cast();
} else {
return github.releases.listReleases({
owner: 'ef4',
repo: 'liquid-fire'
}).then(function(response) {
var matching;
for (var i=0; i<response.length; i++) {
if (response[i].tag_name === 'v' + version()){
matching = response[i];
break;
}
}
if (!matching) {
throw new Error("found no release with tag v" + version());
}
console.log("found release " + matching.id);
});
}
}

function buildStep(program) {
if (program.nobuild) {
console.log("Skipping website build");
Expand All @@ -109,13 +150,18 @@ if (require.main === module) {
program.option('--nobuild', 'Skip website build')
.option('--nodeploy', 'Skip website deploy')
.option('--nolib', 'Skip library build')
.option('--norelease', 'Skip github release creation')
.parse(process.argv);

require('./github').then(function(github) {
return buildStep(program).then(function(){
return deployStep(program, github);
}).then(function(){
return libraryStep(program);
}).then(function(){
return releaseStep(program, github);
}).then(function(){
return assetUploadStep(program, github);
});
}).catch(function(err){
console.log(err);
Expand Down

0 comments on commit 86bada0

Please sign in to comment.