mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Merge pull request #4002 from microsoft/hediet/b/academic-walrus
Allows for manual nightly builds.
This commit is contained in:
commit
5f70e6fc72
5 changed files with 31 additions and 5 deletions
|
|
@ -23,6 +23,16 @@ resources:
|
||||||
ref: main
|
ref: main
|
||||||
endpoint: Monaco
|
endpoint: Monaco
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- name: vscodeRef
|
||||||
|
displayName: The VS Code commit id. When left empty, the main branched is used.
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
- name: prereleaseVersion
|
||||||
|
displayName: The prerelease version. When left empty, dev-${today} is used.
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
|
||||||
extends:
|
extends:
|
||||||
template: azure-pipelines/npm-package/pipeline.yml@templates
|
template: azure-pipelines/npm-package/pipeline.yml@templates
|
||||||
parameters:
|
parameters:
|
||||||
|
|
@ -35,6 +45,9 @@ extends:
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare nightly
|
- script: yarn ts-node ./scripts/ci/monaco-editor-core-prepare nightly
|
||||||
|
env:
|
||||||
|
VSCODE_REF: ${{ parameters.vscodeRef }}
|
||||||
|
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
||||||
retryCountOnTaskFailure: 5
|
retryCountOnTaskFailure: 5
|
||||||
displayName: Setup, Build & Test monaco-editor-core
|
displayName: Setup, Build & Test monaco-editor-core
|
||||||
|
|
||||||
|
|
@ -51,6 +64,9 @@ extends:
|
||||||
displayName: Install NPM dependencies
|
displayName: Install NPM dependencies
|
||||||
|
|
||||||
- script: yarn ts-node ./scripts/ci/monaco-editor-prepare nightly
|
- script: yarn ts-node ./scripts/ci/monaco-editor-prepare nightly
|
||||||
|
env:
|
||||||
|
VSCODE_REF: ${{ parameters.vscodeRef }}
|
||||||
|
PRERELEASE_VERSION: ${{ parameters.prereleaseVersion }}
|
||||||
retryCountOnTaskFailure: 5
|
retryCountOnTaskFailure: 5
|
||||||
displayName: Setup, Build & Test monaco-editor
|
displayName: Setup, Build & Test monaco-editor
|
||||||
|
|
||||||
|
|
|
||||||
6
scripts/ci/env.ts
Normal file
6
scripts/ci/env.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
export function getEnv(): {
|
||||||
|
VSCODE_REF: string | undefined;
|
||||||
|
PRERELEASE_VERSION: string | undefined;
|
||||||
|
} {
|
||||||
|
return process.env as any;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { mkdir, rm } from 'fs/promises';
|
import { mkdir, rm } from 'fs/promises';
|
||||||
import { join, resolve } from 'path';
|
import { join, resolve } from 'path';
|
||||||
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
||||||
|
import { getEnv } from './env';
|
||||||
|
|
||||||
const selfPath = __dirname;
|
const selfPath = __dirname;
|
||||||
const rootPath = join(selfPath, '..', '..');
|
const rootPath = join(selfPath, '..', '..');
|
||||||
|
|
@ -21,8 +22,8 @@ async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
||||||
version = monacoEditorPackageJson.version;
|
version = monacoEditorPackageJson.version;
|
||||||
ref = monacoEditorPackageJson.vscodeRef;
|
ref = monacoEditorPackageJson.vscodeRef;
|
||||||
} else if (arg === 'nightly') {
|
} else if (arg === 'nightly') {
|
||||||
version = getNightlyVersion(monacoEditorPackageJson.version);
|
version = getNightlyVersion(monacoEditorPackageJson.version, getEnv().PRERELEASE_VERSION);
|
||||||
ref = 'main';
|
ref = getEnv().VSCODE_REF || 'main';
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid argument');
|
throw new Error('Invalid argument');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
import { join, resolve } from 'path';
|
import { join, resolve } from 'path';
|
||||||
import { PackageJson, getNightlyVersion, group, run, writeJsonFile, gitCommitId } from '../lib';
|
import { PackageJson, getNightlyVersion, group, run, writeJsonFile, gitCommitId } from '../lib';
|
||||||
|
import { getEnv } from './env';
|
||||||
|
|
||||||
const selfPath = __dirname;
|
const selfPath = __dirname;
|
||||||
const rootPath = join(selfPath, '..', '..');
|
const rootPath = join(selfPath, '..', '..');
|
||||||
|
|
@ -23,7 +24,7 @@ async function prepareMonacoEditorReleaseStableOrNightly() {
|
||||||
if (arg === 'stable') {
|
if (arg === 'stable') {
|
||||||
version = monacoEditorPackageJson.version;
|
version = monacoEditorPackageJson.version;
|
||||||
} else if (arg === 'nightly') {
|
} else if (arg === 'nightly') {
|
||||||
version = getNightlyVersion(monacoEditorPackageJson.version);
|
version = getNightlyVersion(monacoEditorPackageJson.version, getEnv().PRERELEASE_VERSION);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid argument');
|
throw new Error('Invalid argument');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,16 @@ export async function writeJsonFile(filePath: string, jsonData: unknown): Promis
|
||||||
await writeFile(filePath, JSON.stringify(jsonData, null, '\t') + '\n');
|
await writeFile(filePath, JSON.stringify(jsonData, null, '\t') + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNightlyVersion(version: string): string {
|
export function getNightlyVersion(version: string, prerelease: string | undefined): string {
|
||||||
const pieces = version.split('.');
|
const pieces = version.split('.');
|
||||||
const minor = parseInt(pieces[1], 10);
|
const minor = parseInt(pieces[1], 10);
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const yyyy = date.getUTCFullYear();
|
const yyyy = date.getUTCFullYear();
|
||||||
const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
|
const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
|
||||||
const dd = String(date.getUTCDate()).padStart(2, '0');
|
const dd = String(date.getUTCDate()).padStart(2, '0');
|
||||||
return `0.${minor + 1}.0-dev.${yyyy}${mm}${dd}`;
|
|
||||||
|
prerelease = prerelease || `dev.${yyyy}${mm}${dd}`;
|
||||||
|
return `0.${minor + 1}.0-${prerelease}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PackageJson {
|
export interface PackageJson {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue