From 28944722c797da8ac9c0551da5c49f49b4bc1300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Wed, 14 Oct 2020 16:01:38 +0200 Subject: [PATCH] upload web to CDN --- build/azure-pipelines/upload-cdn.ts | 34 +++++++++++++++++++ .../azure-pipelines/web/product-build-web.yml | 7 ++++ 2 files changed, 41 insertions(+) create mode 100644 build/azure-pipelines/upload-cdn.ts 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(); diff --git a/build/azure-pipelines/web/product-build-web.yml b/build/azure-pipelines/web/product-build-web.yml index 7f4907aa2d9..aded67174f4 100644 --- a/build/azure-pipelines/web/product-build-web.yml +++ b/build/azure-pipelines/web/product-build-web.yml @@ -88,6 +88,13 @@ steps: yarn gulp vscode-web-min-ci displayName: Build +- script: | + set -e + AZURE_STORAGE_ACCOUNT="$(web-storage-account)" \ + AZURE_STORAGE_ACCESS_KEY="$(web-storage-key)" \ + node build/azure-pipelines/upload-cdn.js + displayName: Upload to CDN + # upload only the workbench.web.api.js source maps because # we just compiled these bits in the previous step and the # general task to upload source maps has already been run -- GitLab