Skip to content

Use standard versioning #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extends:
template: azure-pipelines/extension/pre-release.yml@templates
parameters:
ghCreateTag: false
standardizedVersioning: true
l10nSourcePaths: ./src
buildPlatforms:
- name: Linux
Expand All @@ -40,11 +41,6 @@ extends:
- script: npm ci
displayName: npm ci

- script: npm run updateBuildNumber
displayName: Update build number
env:
VSC_BUILD_ID: $(Build.BuildNumber)

- script: npm run esbuild-release
displayName: Build

Expand Down
5 changes: 0 additions & 5 deletions build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ extends:
npm_config_build_from_source: true
VSC_VSCE_TARGET: $(vsceTarget)

- script: npm run updateBuildNumber
displayName: Update build number
env:
VSC_BUILD_ID: $(Build.BuildNumber)

- script: npm run esbuild-release
displayName: Build

Expand Down
65 changes: 0 additions & 65 deletions build/updateBuildNumber.js

This file was deleted.

63 changes: 0 additions & 63 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,69 +293,6 @@ gulp.task(
)
);

gulp.task('updateBuildNumber', async () => {
await updateBuildNumber();
});

/**
* For multi-platform builds We end up generating multiple VSIX in the same pipeline.
* As a result this runs multiple times in the same pipeline,
* and we can have different build numbers for different VSIX.
*
* On CI, we use the Azure Build Number to generate a unique build number.
* The Azure Build Number will contain the date time information of the current build time
*/
function getBuildDate() {
const vscBuildId = process.env.VSC_BUILD_ID || '';
const buildParts = vscBuildId.split('_');
if (buildParts.length >= 3) {
return new Date(
parseInt(buildParts[0].substring(0, 4), 10),
parseInt(buildParts[0].substring(4, 6), 10) - 1,
parseInt(buildParts[0].substring(6), 10),
parseInt(buildParts[1], 10),
parseInt(buildParts[2], 10)
);
} else {
return new Date();
}
}

async function updateBuildNumber() {
// Edit the version number from the package.json
const packageJsonContents = await fs.readFile('package.json', 'utf-8');
const packageJson = JSON.parse(packageJsonContents);

// Change version number
// 3rd part of version is limited to Max Int32 numbers (in VSC Marketplace).
// Hence build numbers can only be YYYY.MMM.2147483647
// NOTE: For each of the following strip the first 3 characters from the build number.
// E.g. if we have build number of `build number = 3264527301, then take 4527301

// To ensure we can have point releases & insider builds, we're going with the following format:
// Insider & Release builds will be YYYY.MMM.100<build number>
// When we have a hot fix, we update the version to YYYY.MMM.110<build number>
// If we have more hot fixes, they'll be YYYY.MMM.120<build number>, YYYY.MMM.130<build number>, & so on.

const versionParts = packageJson.version.split('.');
// New build is of the form `DDDHHMM` (day of year, hours, minute) (7 digits, as out of the 10 digits first three are reserved for `100` or `101` for patches).
// Use date time for build, this way all subsequent builds are incremental and greater than the others before.
// Example build for 3Jan 12:45 will be `0031245`, and 16 Feb 8:50 will be `0470845`
const today = getBuildDate();
const dayCount = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
const dayOfYear = dayCount[today.getMonth()] + today.getDate() + 1;
const buildNumberSuffix = `${dayOfYear.toString().padStart(3, '0')}${(today.getHours() + 1)
.toString()
.padStart(2, '0')}${today.getMinutes().toString().padStart(2, '0')}`;
const buildNumber = `${versionParts[2].substring(0, 3)}${buildNumberSuffix}`;
const newVersion =
versionParts.length > 1 ? `${versionParts[0]}.${versionParts[1]}.${buildNumber}` : packageJson.version;
packageJson.version = newVersion;
console.log('Build Number', newVersion);
// Write back to the package json
await fs.writeFile('package.json', JSON.stringify(packageJson, null, 4), 'utf-8');
}

async function buildWebPack(webpackConfigName, args, env) {
// Remember to perform a case insensitive search.
const allowedWarnings = getAllowedWarningsForWebPack(webpackConfigName).map((item) => item.toLowerCase());
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jupyter-hub",
"displayName": "JupyterHub",
"version": "2025.4.0",
"version": "2025.8.0",
"description": "Support for connecting to Jupyter Hub in VS Code along with the Jupyter Extension",
"publisher": "ms-toolsai",
"preview": true,
Expand Down Expand Up @@ -83,7 +83,6 @@
"test:unittests": "mocha --config ./build/.mocha.unittests.js.json ./out/**/*.unit.test.js",
"lint": "eslint -c .eslintrc.js --ext .ts --ext .tsx src",
"prettier-fix": "prettier 'src/**/*.ts*' --write && prettier 'build/**/*.js' --write",
"updateBuildNumber": "node ./build/updateBuildNumber.js",
"esbuild-base-node": "esbuild ./src/extension.node.ts --bundle --outfile=dist/extension.node.js --external:vscode --external:node:crypto --format=cjs --platform=node",
"esbuild-base-web": "esbuild ./src/extension.web.ts --bundle --outfile=dist/extension.web.js --external:vscode --external:node:crypto --format=cjs --target=es2018 --define:global=this",
"esbuild-test-web": "esbuild ./src/test/suite/index.web.ts --bundle --outfile=dist/test.index.web.js --external:vscode --external:node:crypto --format=cjs --target=es2018 --define:global=this --alias:stream=stream-browserify",
Expand Down