Merge pull request #813 from microsoft/fix-cicd
Change extensionId in code if RC extension
This commit is contained in:
Коммит
3936a5f56a
|
@ -1,10 +1,11 @@
|
|||
const fs = require('fs');
|
||||
|
||||
if (process.env.TRAVIS_TAG) {
|
||||
const ISTESTVERSION = /^v?[0-9]+\.[0-9]+\.[0-9]+-[rR][cC]$/.test(process.env.TRAVIS_TAG || '');
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
||||
if (ISTESTVERSION) {
|
||||
// Modify
|
||||
const isTestVersion = /^v?[0-9]+\.[0-9]+\.[0-9]+-[rR][cC]$/.test(process.env.TRAVIS_TAG || '');
|
||||
if (isTestVersion) {
|
||||
// 1. Modify package.json
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
||||
|
||||
const testName = "test-iot-workbench";
|
||||
const testDisplayName = "Test IoT Workbench";
|
||||
const testPublisher = "IoTDevExBuild";
|
||||
|
@ -13,10 +14,25 @@ if (process.env.TRAVIS_TAG) {
|
|||
packageJson.publisher = testPublisher;
|
||||
packageJson.version = packageJson.version.slice(0, -3);
|
||||
|
||||
// Delete
|
||||
delete packageJson.icon;
|
||||
delete packageJson.aiKey;
|
||||
|
||||
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2) + '\n');
|
||||
|
||||
|
||||
// 2. Modify extensionId in files
|
||||
const extensionIdPattern = /vsciot-vscode.vscode-iot-workbench/g;
|
||||
const rcExtensionId = 'iotdevexbuild.test-iot-workbench';
|
||||
|
||||
const constantFilePath = "src/constants.ts";
|
||||
const arm7DevcontainerJsonFile = "resources/templates/arm7/devcontainer.json";
|
||||
const arm8DevcontainerJsonFile = "resources/templates/arm8/devcontainer.json";
|
||||
const x86DevcontainerJsonFile = "resources/templates/x86/devcontainer.json";
|
||||
const files = [constantFilePath, arm7DevcontainerJsonFile, arm8DevcontainerJsonFile, x86DevcontainerJsonFile];
|
||||
files.forEach(filePath => {
|
||||
const originalJsonFile = fs.readFileSync(filePath).toString();
|
||||
const replaceJson = originalJsonFile.replace(extensionIdPattern, rcExtensionId);
|
||||
fs.writeFileSync(filePath, replaceJson);
|
||||
});
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче