diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-25 22:15:03 -0500 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-25 22:15:03 -0500 |
commit | ad666ac47a03f63aa7c2b5ecfe9a7d76c6a033d2 (patch) | |
tree | 066ae6fc8273537dce0f606922c0979f10fb208f /upload_to_mega.js | |
parent | e7dd4d34aa05b185cca8224fa47125f21856f05d (diff) | |
parent | cb39f92e6cd594a483631b2e42385902f9571d18 (diff) |
Merge pull request #484 from chinhodado/build
AppVeyor: Upload build to Mega upon build completion
Diffstat (limited to 'upload_to_mega.js')
-rw-r--r-- | upload_to_mega.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/upload_to_mega.js b/upload_to_mega.js new file mode 100644 index 000000000..c0abd5ed5 --- /dev/null +++ b/upload_to_mega.js @@ -0,0 +1,28 @@ +var util = require('util'); +var exec = require('child_process').exec; +var sanitize = require("sanitize-filename"); + +var email = process.env.MEGA_EMAIL; +var password = process.env.MEGA_PASSWORD; +var sourceFileName = 'build.7z'; +var dstFileName = process.env.APPVEYOR_REPO_COMMIT.substring(0, 8) + " - " + + process.env.APPVEYOR_REPO_COMMIT_MESSAGE.substring(0, 100) + ".7z"; +dstFileName = sanitize(dstFileName); + +var cmd = util.format('megaput ../%s --path \"/Root/Citra/Windows/%s\" --username=%s --password=%s --no-progress', + sourceFileName, + dstFileName, + email, + password); + +// only upload build on master branch, and not on other branches or PRs +if (process.env.APPVEYOR_REPO_BRANCH == "master") { + console.log("Uploading file " + dstFileName + " to Mega..."); + exec(cmd, function(error, stdout, stderr) { + console.log('stdout: ' + stdout); + console.log('stderr: ' + stderr); + if (error !== null) { + console.log('exec error: ' + error); + } + }); +} |