Skip to content

Commit

Permalink
Backport PR #15042: Commit JS and Python packages in one commit on re…
Browse files Browse the repository at this point in the history
…lease (#15260)

Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
  • Loading branch information
meeseeksmachine and jtpio committed Oct 18, 2023
1 parent e57e55b commit befdc93
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 45 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
default: "ensure-sha"

jobs:
publish_release:
Expand Down
10 changes: 5 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ On the [Actions](https://github.com/jupyterlab/jupyterlab/actions) page, select

Fill in the information as mentioned in the body of the changelog PR, for example:

| Input | Value |
| ------------------------------------- | ---------- |
| The target branch | main |
| The URL of the draft GitHub release | |
| Comma separated list of steps to skip | ensure-sha |
| Input | Value |
| ------------------------------------- | ----- |
| The target branch | main |
| The URL of the draft GitHub release | |
| Comma separated list of steps to skip | |

The "Publish Release" workflow:

Expand Down
28 changes: 8 additions & 20 deletions buildutils/src/bumpversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ commander

// Handle dry runs.
if (opts.dryRun) {
utils.run(`bumpversion --dry-run --verbose ${spec}`);
utils.run(`bumpversion --allow-dirty --dry-run --verbose ${spec}`);
return;
}

Expand All @@ -80,18 +80,13 @@ commander
lernaVersion += ' --preid=alpha';
}

let cmd = `lerna version -m \"[ci skip] New version\" --force-publish=* --no-push ${lernaVersion}`;
let cmd = `lerna version --no-git-tag-version --force-publish=* --no-push ${lernaVersion}`;
if (opts.force) {
cmd += ' --yes';
}
const oldVersion = utils.run(
'git rev-parse HEAD',
{
stdio: 'pipe',
encoding: 'utf8'
},
true
);

const oldVersion = utils.getJSVersion('metapackage');

// For a major release, we bump 10 minor versions so that we do
// not conflict with versions during minor releases of the top
// level package.
Expand All @@ -103,21 +98,14 @@ commander
utils.run(cmd);
}

const newVersion = utils.run(
'git rev-parse HEAD',
{
stdio: 'pipe',
encoding: 'utf8'
},
true
);
if (oldVersion === newVersion) {
const newVersion = utils.getJSVersion('metapackage');
if (spec !== 'major' && oldVersion === newVersion) {
// lerna didn't version anything, so we assume the user aborted
throw new Error('Lerna aborted');
}

// Bump the version.
utils.run(`bumpversion ${spec}`);
utils.run(`bumpversion --allow-dirty ${spec}`);

// Run the post-bump script.
utils.postbump(commit);
Expand Down
25 changes: 6 additions & 19 deletions buildutils/src/patch-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,25 @@ commander
utils.prebump();

// Version the changed
let cmd = `lerna version patch -m \"[ci skip] New version\" --no-push`;
let cmd = `lerna version patch --no-git-tag-version --no-push`;
if (options.all) {
cmd += ' --force-publish=*';
}
if (options.force) {
cmd += ' --yes';
}
const oldVersion = utils.run(
'git rev-parse HEAD',
{
stdio: 'pipe',
encoding: 'utf8'
},
true
);

const oldVersion = utils.getJSVersion('metapackage');
utils.run(cmd);
const newVersion = utils.run(
'git rev-parse HEAD',
{
stdio: 'pipe',
encoding: 'utf8'
},
true
);
const newVersion = utils.getJSVersion('metapackage');

if (oldVersion === newVersion) {
console.debug('aborting');
// lerna didn't version anything, so we assume the user aborted
throw new Error('Lerna aborted');
}

// Patch the python version
utils.run('bumpversion patch'); // switches to alpha
utils.run('bumpversion patch --allow-dirty'); // switches to alpha
utils.run('bumpversion release --allow-dirty'); // switches to beta
utils.run('bumpversion release --allow-dirty'); // switches to rc.
utils.run('bumpversion release --allow-dirty'); // switches to final.
Expand Down

0 comments on commit befdc93

Please sign in to comment.