Fixes pipelines (#4107)

This commit is contained in:
Henning Dieterichs 2023-07-31 16:00:49 +02:00 committed by GitHub
parent e637c1f34c
commit 50a8a5ffbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 18 deletions

View file

@ -1,6 +1,15 @@
export function getEnv(): {
VSCODE_REF: string | undefined;
PRERELEASE_VERSION: string | undefined;
} {
return process.env as any;
interface Env {
VSCODE_REF: string;
PRERELEASE_VERSION: string;
}
export function getNightlyEnv(): Env {
const env: Env = process.env as any;
if (!env.PRERELEASE_VERSION) {
throw new Error(`Missing PRERELEASE_VERSION in process.env`);
}
if (!env.VSCODE_REF) {
throw new Error(`Missing VSCODE_REF in process.env`);
}
return env;
}

View file

@ -1,7 +1,7 @@
import { mkdir, rm } from 'fs/promises';
import { join, resolve } from 'path';
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
import { getEnv } from './env';
import { getNightlyEnv } from './env';
const selfPath = __dirname;
const rootPath = join(selfPath, '..', '..');
@ -22,8 +22,11 @@ async function prepareMonacoEditorCoreReleaseStableOrNightly() {
version = monacoEditorPackageJson.version;
ref = monacoEditorPackageJson.vscodeRef;
} else if (arg === 'nightly') {
version = getNightlyVersion(monacoEditorPackageJson.version, getEnv().PRERELEASE_VERSION);
ref = getEnv().VSCODE_REF || 'main';
version = getNightlyVersion(
monacoEditorPackageJson.version,
getNightlyEnv().PRERELEASE_VERSION
);
ref = getNightlyEnv().VSCODE_REF;
} else {
throw new Error('Invalid argument');
}

View file

@ -1,7 +1,7 @@
import { readFile } from 'fs/promises';
import { join, resolve } from 'path';
import { PackageJson, getNightlyVersion, group, run, writeJsonFile, gitCommitId } from '../lib';
import { getEnv } from './env';
import { getNightlyEnv } from './env';
const selfPath = __dirname;
const rootPath = join(selfPath, '..', '..');
@ -24,7 +24,10 @@ async function prepareMonacoEditorReleaseStableOrNightly() {
if (arg === 'stable') {
version = monacoEditorPackageJson.version;
} else if (arg === 'nightly') {
version = getNightlyVersion(monacoEditorPackageJson.version, getEnv().PRERELEASE_VERSION);
version = getNightlyVersion(
monacoEditorPackageJson.version,
getNightlyEnv().PRERELEASE_VERSION
);
} else {
throw new Error('Invalid argument');
}