diff options
author | João Moreno <joao.moreno@microsoft.com> | 2020-10-14 17:01:38 +0300 |
---|---|---|
committer | João Moreno <joao.moreno@microsoft.com> | 2020-10-14 17:02:07 +0300 |
commit | 28944722c797da8ac9c0551da5c49f49b4bc1300 (patch) | |
tree | 9d2903006ae9e53a88ca9243f49168a555c836e6 /build/azure-pipelines/upload-cdn.ts | |
parent | 26eefd4b0a104d224f0c572e968f4eb360d63c15 (diff) |
upload web to CDN
Diffstat (limited to 'build/azure-pipelines/upload-cdn.ts')
-rw-r--r-- | build/azure-pipelines/upload-cdn.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/build/azure-pipelines/upload-cdn.ts b/build/azure-pipelines/upload-cdn.ts new file mode 100644 index 00000000000..952e061e158 --- /dev/null +++ b/build/azure-pipelines/upload-cdn.ts @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import * as path from 'path'; +import * as es from 'event-stream'; +import * as Vinyl from 'vinyl'; +import * as vfs from 'vinyl-fs'; +import * as util from '../lib/util'; +import * as filter from 'gulp-filter'; +const azure = require('gulp-azure-storage'); + +const root = path.dirname(path.dirname(__dirname)); +const commit = util.getVersion(root); + +function main() { + return vfs.src('**', { cwd: '../vscode-web', base: '../vscode-web', dot: true }) + .pipe(filter(f => !f.isDirectory())) + .pipe(es.through(function (data: Vinyl) { + console.log('Uploading CDN file:', data.relative); // debug + this.emit('data', data); + })) + .pipe(azure.upload({ + account: process.env.AZURE_STORAGE_ACCOUNT, + key: process.env.AZURE_STORAGE_ACCESS_KEY, + container: 'web', + prefix: commit + '/' + })); +} + +main(); |