forked from AzureCR/vscode-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (50 loc) · 2.66 KB
/
gulpfile.js
File metadata and controls
54 lines (50 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md 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');
const brightYellowFormatting = '\x1b[33m\x1b[1m%s\x1b[0m';
const brightWhiteFormatting = '\x1b[1m%s\x1b[0m';
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 storageName = process.env.STORAGE_NAME;
const storageKey = process.env.STORAGE_KEY;
if (!storageName || !storageKey) {
console.log();
console.log(brightYellowFormatting, '======== Skipping upload of VSIX to storage account because STORAGE_NAME and STORAGE_KEY have not been set');
} else {
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 {
console.log();
console.log(brightYellowFormatting, '================================================ vsix url ================================================');
console.log();
console.log(brightWhiteFormatting, blobService.getUrl(containerName, blobPath));
console.log();
console.log(brightYellowFormatting, '==========================================================================================================');
console.log();
}
});
}
});
}
}
});