Skip to content

Commit

Permalink
Merge pull request #6462 from blink1073/release-notes
Browse files Browse the repository at this point in the history
More release cleanup
  • Loading branch information
jasongrout committed Jun 4, 2019
2 parents 0b45a77 + a3d6c94 commit cf98435
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 40 deletions.
3 changes: 2 additions & 1 deletion RELEASE.md
Expand Up @@ -73,7 +73,8 @@ JupyterLab itself, run `jlpm run bumpversion major`.
- Push the commits and tags as prompted.
- Run `jlpm run publish:all` to publish the JS and Python packages.
Execute the suggested commands after doing a quick sanity check.

If there is a network error during JS publish, run `jlpm run publish:all --skip-build` to resume publish without requiring another
clean and build phase of the JS packages.
- Run `jlpm run bumpversion release` to switch to an `rc` version.
(running `jlpm run bumpversion build` will then increment `rc` versions).

Expand Down
94 changes: 55 additions & 39 deletions buildutils/src/publish.ts
Expand Up @@ -3,49 +3,65 @@
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

import commander from 'commander';
import * as path from 'path';
import { handlePackage } from './update-dist-tag';
import * as utils from './utils';

async function main() {
// Ensure a clean state.
utils.run('jlpm run clean:slate');

// Publish JS to the appropriate tag.
const curr = utils.getPythonVersion();
if (curr.indexOf('rc') === -1 && curr.indexOf('a') === -1) {
utils.run('lerna publish from-package -m "Publish"');
} else {
utils.run('lerna publish from-package --npm-tag=next -m "Publish"');
}

// Fix up any tagging issues.
const basePath = path.resolve('.');
const paths = utils.getLernaPaths(basePath).sort();
const cmds = await Promise.all(paths.map(handlePackage));
cmds.forEach(cmdList => {
cmdList.forEach(cmd => {
utils.run(cmd);
// Specify the program signature.
commander
.description('Publish the JS packages and prep the Python package')
.option(
'--skip-build',
'Skip the clean and build step (if there was a network error during a JS publish'
)
.action(async (options: any) => {
// Make sure we are logged in.
if (utils.checkStatus('npm whoami') !== 0) {
console.error('Please run `npm login`');
}

// Optionally clean and build the python packages.
if (!options.skipBuild) {
// Ensure a clean state.
utils.run('jlpm run clean:slate');
}

// Publish JS to the appropriate tag.
const curr = utils.getPythonVersion();
if (curr.indexOf('rc') === -1 && curr.indexOf('a') === -1) {
utils.run('lerna publish from-package -m "Publish"');
} else {
utils.run('lerna publish from-package --npm-tag=next -m "Publish"');
}

// Fix up any tagging issues.
const basePath = path.resolve('.');
const paths = utils.getLernaPaths(basePath).sort();
const cmds = await Promise.all(paths.map(handlePackage));
cmds.forEach(cmdList => {
cmdList.forEach(cmd => {
utils.run(cmd);
});
});

// Update core mode. This cannot be done until the JS packages are
// released.
utils.run('node buildutils/lib/update-core-mode.js');

// Make the Python release.
utils.run('python setup.py sdist');
utils.run('python setup.py bdist_wheel');
utils.run('python -m pip install -U twine');
utils.run('twine check dist/*');

// Prompt the user to finalize.
console.log('*'.repeat(40));
console.log('Ready to publish!');
console.log('Run these command when ready:');
console.log(`git tag v${curr}`);
console.log(`git commit -am "Publish ${curr}"`);
console.log('twine upload dist/*');
});

// Update core mode. This cannot be done until the JS packages are
// released.
utils.run('node buildutils/lib/update-core-mode.js');

// Make the Python release.
utils.run('python setup.py sdist');
utils.run('python setup.py bdist_wheel');
utils.run('python -m pip install -U twine');
utils.run('twine check dist/*');

// Prompt the user to finalize.
console.log('*'.repeat(40));
console.log('Ready to publish!');
console.log('Run these command when ready:');
console.log(`git tag v${curr}`);
console.log(`git commit -am "Publish ${curr}"`);
console.log('twine upload dist/*');
}

void main();
commander.parse(process.argv);

0 comments on commit cf98435

Please sign in to comment.