Skip to content

Commit

Permalink
🚸 Prompt for changelog link in lamindb
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf committed Sep 4, 2024
1 parent eefb66a commit b0fcaad
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions laminci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

parser = argparse.ArgumentParser("laminci")
subparsers = parser.add_subparsers(dest="command")
migr = subparsers.add_parser(
release = subparsers.add_parser(
"release",
help="Help with release",
description=(
"Assumes you manually prepared the release commit!\n\n"
"Please edit the version number in your package and prepare the release notes!"
),
)
aa = migr.add_argument
aa = release.add_argument
aa("--pypi", default=False, action="store_true", help="Publish to PyPI")
aa("--changelog", default=None, help="Link to changelog entry")
subparsers.add_parser(
"doc-changes",
help="Write latest changes",
Expand Down Expand Up @@ -157,6 +158,11 @@ def main():
f"Your version ({version}) should increment the previous version"
f" ({previous_version})"
)
if package_name == "lamindb" and args.changelog is None:
raise SystemExit(
"Please pass a link to the changelog entry via: --changelog"
" 'your-link'"
)
else:
assert Path.cwd().name == "laminhub"
if not (Path.cwd().parent / "laminhub-public").exists():
Expand All @@ -168,12 +174,13 @@ def main():
with open("ui/package.json", "r") as file:
version = json.load(file)["version"]

pypi = " & publish to PyPI" if args.pypi else ""
print(f"INFO: You will add this changelog link: {args.changelog}")
print(
"WARNING: This will run `git add -u` & commit everything into the release"
" commit. Please ensure all your current changes should appear in the"
" release commit. Typically, you only bump the version number. "
)
pypi = " & publish to PyPI" if args.pypi else ""
response = input(f"Bump {previous_version} to {version}{pypi}? (y/n)")
if response != "y":
return None
Expand All @@ -189,11 +196,17 @@ def main():
print(f"\nrun: {command}")
run(command, shell=True)

changelog_link = (
args.changelog
if args.changelog is not None
else "https://docs.lamin.ai/changelog"
)

publish_github_release(
repo_name=f"laminlabs/{package_name}",
version=version,
release_name=f"Release {version}",
body="See https://docs.lamin.ai/changelog",
body=f"See {changelog_link}",
)
if is_laminhub:
update_readme_version("../laminhub-public/README.md", version)
Expand All @@ -203,7 +216,7 @@ def main():
publish_github_release(
repo_name="laminlabs/laminhub-public",
version=version,
body="See https://docs.lamin.ai/changelog",
body=f"See {changelog_link}",
release_name=f"Release {version}",
generate_release_notes=False,
cwd="../laminhub-public",
Expand Down

0 comments on commit b0fcaad

Please sign in to comment.