Skip to content

Commit

Permalink
Merge pull request #8508 from OpenMined/rasswanth/release-script
Browse files Browse the repository at this point in the history
Bump Versions Release Script
  • Loading branch information
rasswanth-s authored Feb 19, 2024
2 parents 15f7d1c + 0ea5ab7 commit 8fffebe
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 8 deletions.
22 changes: 17 additions & 5 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@ values =
[bumpversion:part:prenum]
first_value = 1

# Root

[bumpversion:file:VERSION]

[bumpversion:file:packages/grid/devspace.yaml]
# Syft

[bumpversion:file:packages/syft/setup.cfg]

[bumpversion:file:packages/syft/src/syft/__init__.py]

[bumpversion:file:packages/syft/src/syft/VERSION]

# Grid

[bumpversion:file:packages/grid/devspace.yaml]

[bumpversion:file:packages/grid/VERSION]

[bumpversion:file:packages/grid/backend/worker_cpu.dockerfile]
Expand All @@ -44,14 +50,20 @@ first_value = 1

[bumpversion:file:packages/grid/helm/syft/Chart.yaml]

[bumpversion:file:packages/grid/podman/podman-kube/podman-syft-kube.yaml]

[bumpversion:file:packages/grid/podman/podman-kube/podman-syft-kube-config.yaml]

[bumpversion:file:packages/grid/helm/syft/values.yaml]

# Hagrid

[bumpversion:file:packages/hagrid/hagrid/manifest_template.yml]

[bumpversion:file:packages/hagrid/hagrid/deps.py]

[bumpversion:file:packages/grid/podman/podman-kube/podman-syft-kube.yaml]

[bumpversion:file:packages/grid/podman/podman-kube/podman-syft-kube-config.yaml]
# Syft CLI

[bumpversion:file:packages/syftcli/manifest.yml]

[bumpversion:file:packages/grid/helm/syft/values.yaml]

25 changes: 25 additions & 0 deletions .bumpversion_stable.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[bumpversion]
current_version = 0.8.3
tag = False
tag_name = {new_version}
commit = True
parse =
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
serialize =
{major}.{minor}.{patch}

# Syft

[bumpversion:file:packages/syft/src/syft/stable_version.py]

# Hagrid

[bumpversion:file:packages/hagrid/hagrid/stable_version.py]

[bumpversion:file:packages/hagrid/hagrid/cache.py]


6 changes: 6 additions & 0 deletions .github/workflows/cd-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ jobs:
push: "origin gh-pages"
cwd: "./ghpages/"

# Since the post-release tests are dependent on the release being available on PyPI
# we need to wait for PyPI to update before running the post-release tests
- name: Wait for PyPI to update
run: |
sleep 60
# Can we remove the always flag from the below job?
call-cd-post-release-tests:
needs: [deploy-syft]
Expand Down
2 changes: 1 addition & 1 deletion packages/hagrid/hagrid/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from .cache import arg_cache
from .deps import DEPENDENCIES
from .deps import LATEST_BETA_SYFT
from .deps import LATEST_STABLE_SYFT
from .deps import allowed_hosts
from .deps import check_docker_service_status
from .deps import check_docker_version
Expand Down Expand Up @@ -93,6 +92,7 @@
from .quickstart_ui import fetch_notebooks_from_zipfile
from .quickstart_ui import quickstart_download_notebook
from .rand_sec import generate_sec_random_password
from .stable_version import LATEST_STABLE_SYFT
from .style import RichGroup
from .util import fix_windows_virtualenv_api
from .util import from_url
Expand Down
1 change: 0 additions & 1 deletion packages/hagrid/hagrid/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from .nb_output import NBOutput
from .version import __version__

LATEST_STABLE_SYFT = "0.8.3"
LATEST_BETA_SYFT = "0.8.4-beta.30"

DOCKER_ERROR = """
Expand Down
1 change: 1 addition & 0 deletions packages/hagrid/hagrid/stable_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LATEST_STABLE_SYFT = "0.8.3"
2 changes: 1 addition & 1 deletion packages/syft/src/syft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
from .service.response import SyftSuccess # noqa: F401
from .service.user.roles import Roles as roles # noqa: F401
from .service.user.user_service import UserService # noqa: F401
from .stable_version import LATEST_STABLE_SYFT
from .types.twin_object import TwinObject # noqa: F401
from .types.uid import UID # noqa: F401
from .util import filterwarnings # noqa: F401
Expand All @@ -81,7 +82,6 @@
from .util.util import get_root_data_path # noqa: F401
from .util.version_compare import make_requires

LATEST_STABLE_SYFT = "0.8.3"
requires = make_requires(LATEST_STABLE_SYFT, __version__)


Expand Down
1 change: 1 addition & 0 deletions packages/syft/src/syft/stable_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LATEST_STABLE_SYFT = "0.8.3"
94 changes: 94 additions & 0 deletions scripts/bump_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# The script mainly help in bumping the version of the package
# during release process.

# stdlib
# It covers mainly two scenarios:
# Bumping from beta to the stable version
# Bumping from stable to the next beta version
import argparse
import subprocess
import sys

# Command line processing


def bump_to_stable(version: str):
print(f"Bumping to stable version {version}.")

# Invoke bump2version by subprocess and pass the version

# bumping beta to stable
subprocess.run(
[
"bump2version",
"prenum",
"--new-version",
version,
"--no-commit",
"--allow-dirty",
],
check=True,
)
# bumping previous stable to current stable
subprocess.run(
[
"bump2version",
"patch",
"--config-file",
".bumpversion_stable.cfg",
"--new-version",
version,
"--no-commit",
"--allow-dirty",
],
check=True,
)


def bump_to_next_beta(version: str):
version = version + "-beta.0"
print(f"Bumping to next beta version {version}.")

# bumping stable to beta
subprocess.run(
[
"bump2version",
"prenum",
"--new-version",
version,
"--no-commit",
"--allow-dirty",
],
check=True,
)


def handle_command_line():
parser = argparse.ArgumentParser(description="Bump the version of the package.")
parser.add_argument(
"--bump-to-stable",
type=str,
help="Bump the current beta version to a stable version.",
)
parser.add_argument(
"--bump-to-next-beta",
type=str,
help="Bump the current stable version to the next beta version.",
)

if len(sys.argv) < 2:
parser.print_help()
sys.exit(1)

args = parser.parse_args()
if args.bump_to_stable:
bump_to_stable(args.bump_to_stable)
elif args.bump_to_next_beta:
bump_to_next_beta(args.bump_to_next_beta)
else:
parser.print_help()
sys.exit(1)


if __name__ == "__main__":
handle_command_line()

0 comments on commit 8fffebe

Please sign in to comment.