Skip to content

Commit

Permalink
Add upload-vsix to travis ci (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba authored and Stephen Weatherford committed Mar 24, 2018
1 parent 06a5b7d commit a2c6072
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ install:
- npm install

script:
- npm run vscode:prepublish
- gulp package
- gulp upload-vsix
- npm test

notifications:
Expand Down
46 changes: 46 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

const gulp = require('gulp');
const path = require('path');
const azureStorage = require('azure-storage');
const vsce = require('vsce');
const packageJson = require('./package.json');

gulp.task('package', async () => {
await vsce.createVSIX();
});

gulp.task('upload-vsix', (callback) => {
if (process.env.TRAVIS_PULL_REQUEST_BRANCH) {
console.log('Skipping upload-vsix for PR build.');
} else {
const containerName = packageJson.name;
const vsixName = `${packageJson.name}-${packageJson.version}.vsix`;
const blobPath = path.join(process.env.TRAVIS_BRANCH, process.env.TRAVIS_BUILD_NUMBER, vsixName);
const blobService = azureStorage.createBlobService(process.env.STORAGE_NAME, process.env.STORAGE_KEY);
blobService.createContainerIfNotExists(containerName, { publicAccessLevel: "blob" }, (err) => {
if (err) {
callback(err);
} else {
blobService.createBlockBlobFromLocalFile(containerName, blobPath, vsixName, (err) => {
if (err) {
callback(err);
} else {
const brightYellowFormatting = '\x1b[33m\x1b[1m%s\x1b[0m';
const brightWhiteFormatting = '\x1b[1m%s\x1b[0m';
console.log();
console.log(brightYellowFormatting, '================================================ vsix url ================================================');
console.log();
console.log(brightWhiteFormatting, blobService.getUrl(containerName, blobPath));
console.log();
console.log(brightYellowFormatting, '==========================================================================================================');
console.log();
}
});
}
});
}
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,12 @@
"@types/socket.io": "^1.4.28",
"@types/socket.io-client": "^1.4.27",
"antlr4ts-cli": "^0.4.0-alpha.4",
"azure-storage": "^2.8.1",
"gulp": "^3.9.1",
"mocha": "^2.3.3",
"typescript": "^2.0.3",
"vscode": "^1.0.0"
"vscode": "^1.0.0",
"vsce": "^1.37.5"
},
"dependencies": {
"antlr4ts": "^0.4.0-alpha.4",
Expand Down

0 comments on commit a2c6072

Please sign in to comment.