diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 532b5c3bd..e7bb86433 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -57,22 +57,9 @@ jobs: run: | pip install . - - name: Configure Version Spec - id: version-spec - if: ${{ matrix.group == 'check_release' }} - run: | - set -eux - version=$(python setup.py --version) - if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - version_spec=patch - else - version_spec=build - fi - echo "::set-output name=spec::${version_spec}" - - name: Check Release uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 env: - RH_VERSION_SPEC: ${{ steps.version-spec.outputs.spec }} + RH_VERSION_SPEC: next with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/RELEASE.md b/RELEASE.md index 5761ead34..7517fbc52 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -12,6 +12,10 @@ For now releases are still done manually (see section below). https://github.com/jupyterlab/jupyterlab/blob/master/RELEASE.md#bump-version +`jupyter_releaser` handles the bump automatically so it is not necessary to do it manually, as long as the spec is correctly specified in the workflow. + +### Manual bump + To manually bump the version, run: ```bash @@ -22,7 +26,13 @@ python -m pip install -e ".[test,dev]" python scripts/bump-version.py ``` -Where `` can be one of the following: `patch`, `minor`, `major`, `release`. +Where `` can be one of the following: `patch`, `minor`, `major`, `release` or `next` (auto for `patch` or `minor`). + +## Major JS bump + +When there is a breaking change in a JS package, the version of the package should be bumped by one major version. + +For example if the version of the preview extension was `2.1.0-alpha.1` and a breaking is introduced, bump to `3.0.0-alpha.0`. ## Releasing on conda-forge @@ -55,8 +65,7 @@ Make sure the `dist/` folder is empty. 1. Bump the version: - `python -m pip install bump2version jupyter-releaser` - - For a patch release: `python scripts/bump-version patch` - - For a build release: `python scripts/bump-version build` + - For a patch or build release: `python scripts/bump-version next` 2. `python -m build` 3. Double check the size of the bundles in the `dist/` folder 4. Make sure the JupyterLab extension is correctly bundled in source distribution diff --git a/scripts/bump-version.py b/scripts/bump-version.py index 49008150c..551d01b89 100644 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -6,7 +6,7 @@ # - https://github.com/jupyterlab/retrolab/blob/main/buildutils/src/release-bump.ts import click -from jupyter_releaser.util import get_version, run +from jupyter_releaser.util import is_prerelease, get_version, run OPTIONS = ["major", "minor", "release", "build"] @@ -14,7 +14,7 @@ def patch(force=False): version = get_version() - if "a" in version or "b" in version or "rc" in version: + if is_prerelease(version): raise Exception("Can only make a patch release from a final version") run("bumpversion patch", quiet=True) @@ -40,7 +40,7 @@ def update(spec, force=False): if spec not in OPTIONS: raise Exception(f"Version spec must be one of: {OPTIONS}") - is_final = "a" not in prev and "b" not in prev and "c" not in prev + is_final = not is_prerelease(prev) if is_final and spec == "release": raise Exception('Use "major" or "minor" to switch back to alpha release') @@ -94,6 +94,11 @@ def bump(force, spec): if len(status) > 0: raise Exception("Must be in a clean git state with no untracked files") + prev = get_version() + is_final = not is_prerelease(prev) + if spec == "next": + spec = "patch" if is_final else "build" + if spec == "patch": patch(force) return