Browse Source

Add package build + deployment for Linux

reviewable/pr226/r1
Albert Huang 6 years ago
parent
commit
892d712ec0
  1. 5
      .travis.yml
  2. 50
      gulpfile.js
  3. 35
      sig/publish-linux.js
  4. 0
      sig/publish-mac.js

5
.travis.yml

@ -1,5 +1,6 @@
os:
- osx
- linux
cache:
directories:
@ -18,7 +19,9 @@ branches:
- website
script:
- npm run test && ./sig/import.sh && npm run make:darwin && node ./sig/publish.js
- npm run test
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./sig/import.sh && npm run make:darwin && node ./sig/publish-mac.js; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then npm run make:linux && echo Success #&& node ./sig/publish-linux.js
notifications:
webhooks:

50
gulpfile.js

@ -69,7 +69,10 @@ const cleanGlob = (glob) => {
gulp.task('clean', cleanGlob(['./build', './dist']));
gulp.task('clean-dist-win', cleanGlob(`./dist/${packageJSON.productName}-win32-ia32`));
gulp.task('clean-dist-darwin', cleanGlob(`./dist/${packageJSON.productName}-darwin-ia32`));
gulp.task('clean-dist-linux', cleanGlob(`./dist/${packageJSON.productName}-linux-ia32`));
gulp.task('clean-dist-linux', cleanGlob([
`./dist/${packageJSON.productName}-linux-ia32`,
`./dist/${packageJSON.productName}-linux-x64`
]));
gulp.task('clean-external', cleanGlob('./build/external.js'));
gulp.task('clean-material', cleanGlob('./build/assets/material'));
gulp.task('clean-utility', cleanGlob('./build/assets/util'));
@ -197,7 +200,52 @@ gulp.task('package:linux', ['clean-dist-linux', 'build'], (done) => {
});
gulp.task('make:linux', ['package:linux'], (done) => {
const pathEscapedName = packageJSON.productName.replace(/ /gi, '\ ');
// Zip Linux x86
const child = spawn('zip', ['-r', '-y',
`${pathEscapedName}-linux-ia32.zip`,
`.`],
{
cwd: `./dist/${packageJSON.productName}-linux-ia32`,
});
console.log(`Zipping "${packageJSON.productName}-linux-ia32"`); // eslint-disable-line
// spit stdout to screen
child.stdout.on('data', (data) => { process.stdout.write(data.toString()); });
// Send stderr to the main console
child.stderr.on('data', (data) => {
process.stdout.write(data.toString());
});
child.on('close', (code) => {
console.log('Finished zipping with code ' + code); // eslint-disable-line
});
// Zip Linux x64
const child2 = spawn('zip', ['-r', '-y',
`${pathEscapedName}-linux-x64.zip`,
`.`],
{
cwd: `./dist/${packageJSON.productName}-linux-x64`,
});
console.log(`Zipping "${packageJSON.productName}-linux-x64"`); // eslint-disable-line
// spit stdout to screen
child2.stdout.on('data', (data) => { process.stdout.write(data.toString()); });
// Send stderr to the main console
child2.stderr.on('data', (data) => {
process.stdout.write(data.toString());
});
child2.on('close', (code) => {
console.log('Finished zipping with code ' + code); // eslint-disable-line
done();
});
});
// The default task (called when you run `gulp` from cli)

35
sig/publish-linux.js

@ -0,0 +1,35 @@
'use strict';
const fs = require('fs');
const request = require('request');
const path = require('path');
console.log('Uploading ZIP artifact'); // eslint-disable-line
const req = request.post(`http://linux.googleplaymusicdesktopplayer.com/upload/${process.env.TRAVIS_COMMIT}/${process.env.TRAVIS_BUILD_NUMBER}`, (err, resp, body) => {
if (err) {
console.log('Upload failed with error!'); // eslint-disable-line
console.log(err); // eslint-disable-line
} else {
console.log('Upload sucessfull'); // eslint-disable-line
console.log('URL: ' + body); // eslint-disable-line
}
});
const form = req.form();
form.append('zip', fs.createReadStream(path.resolve(`${__dirname}/../dist/Google Play Music Desktop Player-linux-ia32/Google Play Music Desktop Player.zip`))); // eslint-disable-line
form.append('key', process.env.LINUX_ARTIFACT_KEY || '');
const req2 = request.post(`http://linux.googleplaymusicdesktopplayer.com/upload/${process.env.TRAVIS_COMMIT}/${process.env.TRAVIS_BUILD_NUMBER}`, (err, resp, body) => {
if (err) {
console.log('Upload failed with error!'); // eslint-disable-line
console.log(err); // eslint-disable-line
} else {
console.log('Upload sucessfull'); // eslint-disable-line
console.log('URL: ' + body); // eslint-disable-line
}
});
const form2 = req2.form();
form2.append('zip', fs.createReadStream(path.resolve(`${__dirname}/../dist/Google Play Music Desktop Player-linux-x64/Google Play Music Desktop Player.zip`))); // eslint-disable-line
form2.append('key', process.env.LINUX_ARTIFACT_KEY || '');

0
sig/publish.js → sig/publish-mac.js

Loading…
Cancel
Save