Skip to content

Commit

Permalink
Merge pull request #186 from SFTtech/milo/improved-release-automation
Browse files Browse the repository at this point in the history
improved release automation
  • Loading branch information
mikonse authored Jan 2, 2024
2 parents d5f4ddd + d662abb commit aef5d0e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion abrechnung/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Abrechnung - feature complete payment management and bookkeeping."""

__version__ = "0.12.0"
__version__ = "0.11.0"

MAJOR_VERSION = __version__.split(".")[0]
MINOR_VERSION = __version__.split(".")[1]
Expand Down
2 changes: 1 addition & 1 deletion frontend/apps/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionName "0.11.0"

testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ disable = [
"R",
"fixme",
"logging-fstring-interpolation",
"broad-exception-caught"
]
"broad-exception-caught" ]

[tool.black]
line-length = 120
Expand All @@ -105,8 +104,9 @@ source = [
]

[tool.bumpversion]
current_version = "0.12.0"
current_version = "0.11.0"
commit = false
files = [
{ filename = "abrechnung/__init__.py" },
{ filename = "frontend/apps/mobile/android/app/build.gradle" },
]
34 changes: 32 additions & 2 deletions tools/make_release.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import argparse
import json
import re
import subprocess
from pathlib import Path

repo_root = Path(__file__).parent.parent


def parse_args():
Expand All @@ -10,13 +15,38 @@ def parse_args():
return parser.parse_args()


def _get_next_version(part: str) -> tuple[str, str]:
ret = subprocess.run(
["bump-my-version", "show", "--format", "json", "--increment", part], capture_output=True, check=True
)
result = json.loads(ret.stdout)
return result["current_version"], result["new_version"]


def main(part: str, dry_run: bool):
if dry_run:
print("Performing a dry run ...")
# print current then prompt for new API compatibility version ranges
# call bumpversion
bump_my_version_args = ["bump-my-version", "bump", part, "--dry-run"]
current_version, next_version = _get_next_version(part)
print(f"Current Version: {current_version}, Upgrading to version {next_version}")

bump_my_version_args = ["bump-my-version", "bump", part, "--no-commit", "--no-tag"]
if dry_run:
bump_my_version_args.append("--dry-run")
subprocess.run(bump_my_version_args, check=True)

app_build_gradle = repo_root / "frontend" / "apps" / "mobile" / "android" / "app" / "build.gradle"
gradle_content = app_build_gradle.read_text()
if not dry_run:
version_code_matches = re.findall(r"versionCode (?P<version>\d+)", gradle_content)
for match in version_code_matches:
code = int(match)
gradle_content = gradle_content.replace(f"versionCode {code}", f"versionCode {code + 1}")
app_build_gradle.write_text(gradle_content)

print("Do not forget to update the api version compatibilities")
print("Do not forget to add a debian changelog entry")

# generated changelog from commits / merges / whatever
# print current changelog
# prompt for additional changelog entries
Expand Down

0 comments on commit aef5d0e

Please sign in to comment.