Skip to content

Commit

Permalink
Update tagging routine.
Browse files Browse the repository at this point in the history
  • Loading branch information
antarcticrainforest committed Mar 15, 2024
1 parent bc7a8ce commit 0b30ed1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
24 changes: 6 additions & 18 deletions dev-env/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@ class Release:

version_pattern: str = r'__version__\s*=\s*["\'](\d+\.\d+\.\d+)["\']'

def __init__(
self, package_name: str, repo_dir: str, branch: str = "main"
) -> None:
def __init__(self, package_name: str, repo_dir: str, branch: str = "main") -> None:

self.branch = branch
self.package_name = package_name
self.repo_dir = Path(repo_dir)
logger.info(
"Searching for packages/config with the name: %s", package_name
)
logger.info("Searching for packages/config with the name: %s", package_name)
logger.debug("Reading current git config")
self.git_config = (
Path(git.Repo(search_parent_directories=True).git_dir) / "config"
Expand All @@ -82,9 +78,7 @@ def git_tag(self) -> Version:
try:
# Get the latest tag on the main branch
return Version(
repo.git.describe("--tags", "--abbrev=0", self.branch).lstrip(
"v"
)
repo.git.describe("--tags", "--abbrev=0", self.branch).lstrip("v")
)
except git.exc.GitCommandError:
logger.debug("No tag found")
Expand Down Expand Up @@ -150,9 +144,7 @@ def _check_change_lock_file(self) -> None:
@cached_property
def _change_lock_file(self) -> Path:
"""Find the change lock file."""
for prefix, suffix in product(
("changelog", "whats-new"), (".rst", ".md")
):
for prefix, suffix in product(("changelog", "whats-new"), (".rst", ".md")):
for search_pattern in (prefix, prefix.upper()):
glob_pattern = f"{search_pattern}{suffix}"
logger.debug("Searching for %s", glob_pattern)
Expand All @@ -177,9 +169,7 @@ def tag_new_version(self) -> None:
head = cloned_repo.head.reference
message = f"Create a release for v{self.version}"
try:
cloned_repo.create_tag(
f"v{self.version}", ref=head, message=message
)
cloned_repo.create_tag(f"v{self.version}", ref=head, message=message)
cloned_repo.git.push("--tags")
except git.GitCommandError as error:
raise Exit("Could not create tag: {}".format(error))
Expand All @@ -198,9 +188,7 @@ def cli(cls, temp_dir: str) -> "Release":
"deploy", help="Update the version in the deployment repository"
)
for _parser in tag_parser, deploy_parser:
_parser.add_argument(
"name", help="The name of the software/package."
)
_parser.add_argument("name", help="The name of the software/package.")
_parser.add_argument(
"-v",
"--verbose",
Expand Down
3 changes: 2 additions & 1 deletion src/databrowser/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
from typing import Iterator, List, Tuple, TypedDict
from typing import Iterator, List, Tuple
from typing_extensions import TypedDict

import requests
import tomli
Expand Down

0 comments on commit 0b30ed1

Please sign in to comment.