pulsar/script/cibuild

43 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env node
2013-10-14 12:29:26 +04:00
var cp = require('./utils/child-process-wrapper.js');
var fs = require('fs');
var path = require('path');
2012-08-31 21:43:21 +04:00
2013-10-14 12:29:26 +04:00
process.chdir(path.dirname(__dirname));
2013-06-21 02:26:00 +04:00
2013-12-18 21:48:03 +04:00
if (process.platform == 'linux')
2013-12-17 05:33:45 +04:00
throw new Error('cibuild can not run on linux yet!');
2013-06-21 02:26:00 +04:00
2013-10-14 12:29:26 +04:00
var homeDir = process.platform == 'win32' ? process.env.USERPROFILE : process.env.HOME;
2013-06-21 02:41:23 +04:00
function readEnvironmentVariables() {
var credentialsPath = '/var/lib/jenkins/config/atomcredentials';
try {
var credentials = fs.readFileSync(credentialsPath, 'utf8');
2013-10-27 02:12:13 +04:00
var lines = credentials.trim().split('\n');
for (i in lines) {
var parts = lines[i].split('=');
var key = parts[0].trim();
var value = parts[1].trim().substr(1, parts[1].length - 2);
process.env[key] = value;
2013-10-14 12:29:26 +04:00
}
} catch(error) { }
2013-10-14 12:29:26 +04:00
}
2013-10-04 08:42:15 +04:00
2013-10-27 02:03:21 +04:00
readEnvironmentVariables();
cp.safeExec.bind(global, 'node script/bootstrap', function(error) {
if (error)
process.exit(1);
var async = require('async');
var gruntPath = path.join('node_modules', '.bin', 'grunt') + (process.platform === 'win32' ? '.cmd' : '');
async.series([
2013-12-18 23:17:00 +04:00
console.log.bind(global, 'a'),
require('rimraf').bind(global, path.join(homeDir, '.atom')),
cp.safeExec.bind(global, 'git clean -dff'),
cp.safeExec.bind(global, gruntPath + ' ci --stack --no-color'),
2013-12-18 23:17:00 +04:00
cp.safeExec.bind(global, 'node_modules/.bin/coffee script/upload-release')
], function(error) {
process.exit(error ? 1 : 0);
});
2013-10-27 02:07:20 +04:00
})();