Browse Source

Adds nightly release

Henning Dieterichs 2 years ago
parent
commit
1160858c06

+ 55 - 0
.azure-pipelines/publish-nightly.yml

@@ -0,0 +1,55 @@
+###############################################################################################
+#  Copyright (c) Microsoft Corporation. All rights reserved.
+#  Licensed under the MIT License. See License.txt in the project root for license information.
+###############################################################################################
+name: $(Date:yyyyMMdd)$(Rev:.r)
+
+trigger: none
+pr: none
+
+schedules:
+  - cron: '0 7 * * *'
+    displayName: Daily release
+    branches:
+      include:
+        - main
+
+resources:
+  repositories:
+    - repository: templates
+      type: github
+      name: microsoft/vscode-engineering
+      ref: main
+      endpoint: Monaco
+
+extends:
+  template: azure-pipelines/npm-package/pipeline.yml@templates
+  parameters:
+    npmPackages:
+      - name: monaco-editor-core
+        workingDirectory: $(Build.SourcesDirectory)/dependencies/vscode/out-monaco-editor-core
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor-core nightly
+            displayName: Setup, Build & Test monaco-editor-core
+
+        tag: next
+        publishPackage: true
+        publishRequiresApproval: false
+
+      - name: monaco-editor
+        workingDirectory: $(Build.SourcesDirectory)/release
+        testPlatforms: []
+        buildSteps:
+          - script: npm ci
+            displayName: Install NPM dependencies
+
+          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor nightly
+            displayName: Setup, Build & Test monaco-editor
+
+        tag: next
+        publishPackage: true
+        publishRequiresApproval: false

+ 4 - 11
.azure-pipelines/pipeline.yml → .azure-pipelines/publish-stable.yml

@@ -16,13 +16,6 @@ resources:
       endpoint: Monaco
       endpoint: Monaco
 
 
 parameters:
 parameters:
-  - name: quality
-    displayName: Quality
-    type: string
-    default: latest
-    values:
-      - latest
-      - next
   - name: publishMonacoEditorCore
   - name: publishMonacoEditorCore
     displayName: 🚀 Publish Monaco Editor Core
     displayName: 🚀 Publish Monaco Editor Core
     type: boolean
     type: boolean
@@ -43,10 +36,10 @@ extends:
           - script: npm ci
           - script: npm ci
             displayName: Install NPM dependencies
             displayName: Install NPM dependencies
 
 
-          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor-core-stable
+          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor-core stable
             displayName: Setup, Build & Test monaco-editor-core
             displayName: Setup, Build & Test monaco-editor-core
 
 
-        tag: ${{ parameters.quality }}
+        tag: latest
         publishPackage: ${{ parameters.publishMonacoEditorCore }}
         publishPackage: ${{ parameters.publishMonacoEditorCore }}
         publishRequiresApproval: false
         publishRequiresApproval: false
 
 
@@ -57,9 +50,9 @@ extends:
           - script: npm ci
           - script: npm ci
             displayName: Install NPM dependencies
             displayName: Install NPM dependencies
 
 
-          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor-stable
+          - script: yarn ts-node ./scripts/ci/prepare-monaco-editor stable
             displayName: Setup, Build & Test monaco-editor
             displayName: Setup, Build & Test monaco-editor
 
 
-        tag: ${{ parameters.quality }}
+        tag: latest
         publishPackage: ${{ parameters.publishMonacoEditor }}
         publishPackage: ${{ parameters.publishMonacoEditor }}
         publishRequiresApproval: false
         publishRequiresApproval: false

+ 18 - 7
scripts/ci/prepare-monaco-editor-core-stable.ts → scripts/ci/prepare-monaco-editor-core.ts

@@ -1,6 +1,6 @@
 import { mkdir, rm } from 'fs/promises';
 import { mkdir, rm } from 'fs/promises';
 import { join, resolve } from 'path';
 import { join, resolve } from 'path';
-import { group, gitShallowClone, run, writeJsonFile } from '../lib';
+import { group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
 
 
 const selfPath = __dirname;
 const selfPath = __dirname;
 const rootPath = join(selfPath, '..', '..');
 const rootPath = join(selfPath, '..', '..');
@@ -8,15 +8,26 @@ const dependenciesPath = join(rootPath, 'dependencies');
 const vscodePath = resolve(dependenciesPath, 'vscode');
 const vscodePath = resolve(dependenciesPath, 'vscode');
 const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
 const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
 
 
-async function prepareMonacoEditorCoreReleaseStable() {
+async function prepareMonacoEditorCoreReleaseStableOrNightly() {
 	const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
 	const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
 		version: string;
 		version: string;
 		vscodeRef: string;
 		vscodeRef: string;
 	};
 	};
-	await prepareMonacoEditorCoreRelease(
-		monacoEditorPackageJson.version,
-		monacoEditorPackageJson.vscodeRef
-	);
+	let version: string;
+	let ref: string;
+
+	const arg = process.argv[2];
+	if (arg === 'stable') {
+		version = monacoEditorPackageJson.version;
+		ref = monacoEditorPackageJson.vscodeRef;
+	} else if (arg === 'nightly') {
+		version = getNightlyVersion(monacoEditorPackageJson.version);
+		ref = 'main';
+	} else {
+		throw new Error('Invalid argument');
+	}
+
+	await prepareMonacoEditorCoreRelease(version, ref);
 
 
 	// npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published
 	// npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published
 }
 }
@@ -53,4 +64,4 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
 	});
 	});
 }
 }
 
 
-prepareMonacoEditorCoreReleaseStable();
+prepareMonacoEditorCoreReleaseStableOrNightly();

+ 16 - 4
scripts/ci/prepare-monaco-editor-stable.ts → scripts/ci/prepare-monaco-editor.ts

@@ -1,16 +1,28 @@
 import { readFile } from 'fs/promises';
 import { readFile } from 'fs/promises';
 import { join, resolve } from 'path';
 import { join, resolve } from 'path';
-import { group, run, writeJsonFile } from '../lib';
+import { getNightlyVersion, group, run, writeJsonFile } from '../lib';
 
 
 const selfPath = __dirname;
 const selfPath = __dirname;
 const rootPath = join(selfPath, '..', '..');
 const rootPath = join(selfPath, '..', '..');
 const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
 const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
 
 
-async function prepareMonacoEditorReleaseStable() {
+async function prepareMonacoEditorReleaseStableOrNightly() {
 	const monacoEditorPackageJson = JSON.parse(
 	const monacoEditorPackageJson = JSON.parse(
 		await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
 		await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
 	) as { version: string };
 	) as { version: string };
-	await prepareMonacoEditorRelease(monacoEditorPackageJson.version);
+
+	let version: string;
+
+	const arg = process.argv[2];
+	if (arg === 'stable') {
+		version = monacoEditorPackageJson.version;
+	} else if (arg === 'nightly') {
+		version = getNightlyVersion(monacoEditorPackageJson.version);
+	} else {
+		throw new Error('Invalid argument');
+	}
+
+	await prepareMonacoEditorRelease(version);
 
 
 	// npm package is now in ./release, ready to be published
 	// npm package is now in ./release, ready to be published
 }
 }
@@ -35,4 +47,4 @@ async function prepareMonacoEditorRelease(version: string) {
 	});
 	});
 }
 }
 
 
-prepareMonacoEditorReleaseStable();
+prepareMonacoEditorReleaseStableOrNightly();

+ 10 - 0
scripts/lib/index.ts

@@ -43,3 +43,13 @@ export async function group(name: string, body: () => Promise<void>): Promise<vo
 export async function writeJsonFile(filePath: string, jsonData: unknown): Promise<void> {
 export async function writeJsonFile(filePath: string, jsonData: unknown): Promise<void> {
 	await writeFile(filePath, JSON.stringify(jsonData, null, '\t') + '\n');
 	await writeFile(filePath, JSON.stringify(jsonData, null, '\t') + '\n');
 }
 }
+
+export function getNightlyVersion(version: string): string {
+	const pieces = version.split('.');
+	const minor = parseInt(pieces[1], 10);
+	const date = new Date();
+	const yyyy = date.getUTCFullYear();
+	const mm = String(date.getUTCMonth() + 1).padStart(2, '0');
+	const dd = String(date.getUTCDate()).padStart(2, '0');
+	return `0.${minor + 1}.0-dev.${yyyy}${mm}${dd}`;
+}