Skip to content

Commit

Permalink
chore: add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
mikonse committed Jan 5, 2024
1 parent 8309eba commit 9070b66
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 42 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

## Unreleased

[Compare the full difference.](https://github.com/SFTtech/abrechnung/compare/v0.12.1...HEAD)

## 0.12.1 (2024-01-05)

[Compare the full difference.](https://github.com/SFTtech/abrechnung/compare/v0.12.0...v0.12.1)

### Fixed

- Correctly filter out deleted transactions in balance computations
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

The *Abrechnung* (German for *reckoning*, *settlement*, *revenge*) aims to be a versatile and user-centric **payment**, **transaction** and **bookkeeping** management tool for human groups and events.

>>> You can simply **try** our [**demo instance**](https://demo.abrechnung.sft.lol)!
> You can simply **try** our [**demo instance**](https://demo.abrechnung.sft.lol)!
> You can get the android app over from the [releases page](https://github.com/SFTtech/abrechnung/releases/latest)
Abrechnung is a tool to track *money*, *purchases* (and its items) and *debtors* for:

Group life | Events | Travelling
-|-|-
Flat share roommates | Cooking revelries | Holiday trips
Your Hackerspace | LAN parties | Business trips
Family life | Regular parties | Adventures
... | ... | ...

| Group life | Events | Travelling |
|----------------------|-------------------|----------------|
| Flat share roommates | Cooking revelries | Holiday trips |
| Your Hackerspace | LAN parties | Business trips |
| Family life | Regular parties | Adventures |
| ... | ... | ... |

---

Expand All @@ -38,13 +38,12 @@ To help you set up your instance or understand the inner workings:

## Technical foundation

Technology | Component
------------------|----------
**Python** | Backend logic
**React** | Web UI framework
**PostgresSQL** | Database
**Homo Sapiens** | Magic sauce

| Technology | Component |
|------------------|------------------|
| **Python** | Backend logic |
| **React** | Web UI framework |
| **PostgresSQL** | Database |
| **Homo Sapiens** | Magic sauce |

## Contributing

Expand All @@ -61,12 +60,11 @@ If there is **that feature** you really want to see implemented, you found a **b
To directly reach developers and other users, we have chat rooms.
For questions, suggestions, problem support, please join and just ask!

Contact | Where?
-----------------|-------
Issue Tracker | [SFTtech/abrechnung](https://github.com/SFTtech/abrechnung/issues)
Matrix Chat | [`#sfttech:matrix.org`](https://app.element.io/#/room/#sfttech:matrix.org)
Support us | [![money sink](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/SFTtech)

| Contact | Where? |
|---------------|-------------------------------------------------------------------------------------------------|
| Issue Tracker | [SFTtech/abrechnung](https://github.com/SFTtech/abrechnung/issues) |
| Matrix Chat | [`#sfttech:matrix.org`](https://app.element.io/#/room/#sfttech:matrix.org) |
| Support us | [![money sink](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/SFTtech) |

## License

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ commit = false
files = [
{ filename = "abrechnung/__init__.py" },
{ filename = "frontend/apps/mobile/android/app/build.gradle" },
{ filename = "CHANGELOG.md", search = "Unreleased", replace = "{current_version} ({now:%Y-%m-%d})"},
{ filename = "CHANGELOG.md", search = "v{current_version}...HEAD", replace = "v{current_version}...v{new_version}"},
]
104 changes: 83 additions & 21 deletions tools/make_release.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import argparse
import json
import re
import subprocess
import tomllib
from datetime import datetime
from pathlib import Path

from pydantic import BaseModel

repo_root = Path(__file__).parent.parent

debian_changelog_template = """abrechnung ({new_version}) stable; urgency=medium
* Abrechnung release {new_version}
-- {author_name} <{author_email}> {now:%a, %-d %b %Y %H:%M:%S %z}
"""
unreleased_changelog_template = """## Unreleased
[Compare the full difference.](https://github.com/SFTtech/abrechnung/compare/v{new_version}...HEAD)
"""


class Config(BaseModel):
current_version: str
new_version: str


def parse_args():
parser = argparse.ArgumentParser("Abrechnung release utility")
Expand All @@ -15,26 +36,19 @@ def parse_args():
return parser.parse_args()


def _get_next_version(part: str) -> tuple[str, str]:
def _get_bumpversion_config(part: str) -> Config:
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"]
return Config.model_validate_json(ret.stdout)


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
current_version, next_version = _get_next_version(part)
print(f"Current Version: {current_version}, Upgrading to version {next_version}")
def _read_pyproject_toml():
with open(repo_root / "pyproject.toml", "rb") as f:
return tomllib.load(f)

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)

def _update_app_gradle(dry_run: bool):
app_build_gradle = repo_root / "frontend" / "apps" / "mobile" / "android" / "app" / "build.gradle"
gradle_content = app_build_gradle.read_text()
if not dry_run:
Expand All @@ -44,14 +58,62 @@ def main(part: str, dry_run: bool):
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
# finalize changelog and write
# copy changelog to debian changelog
def _update_debian_changelog(pyproject: dict, config: Config, dry_run: bool):
formatted_debian_changelog = debian_changelog_template.format(
new_version=config.new_version,
now=datetime.now(),
author_name=pyproject["project"]["authors"][0]["name"],
author_email=pyproject["project"]["authors"][0]["email"],
)
print(f"Adding release entry to debian changelog")
deb_changelog_path = repo_root / "debian" / "changelog"
current_deb_changelog = deb_changelog_path.read_text()
new_changelog = formatted_debian_changelog + current_deb_changelog
if not dry_run:
deb_changelog_path.write_text(new_changelog, "utf-8")


def _update_changelog(config: Config, dry_run: bool):
# re-add the unreleased header to the changelog
formatted_unreleased_changelog = unreleased_changelog_template.format(
new_version=config.new_version,
)
changelog_path = repo_root / "CHANGELOG.md"
current_changelog = changelog_path.read_text()
first_line_end = current_changelog.find("\n\n")
new_changelog = (
current_changelog[: first_line_end + 2]
+ formatted_unreleased_changelog
+ current_changelog[first_line_end + 2 :]
)
print(f"Adding unreleased section to CHANGELOG.md")
if not dry_run:
changelog_path.write_text(
new_changelog,
"utf-8",
)


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
config = _get_bumpversion_config(part)
pyproject = _read_pyproject_toml()
print(f"Current Version: {config.current_version}, Upgrading to version {config.new_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)

_update_app_gradle(dry_run)
_update_debian_changelog(pyproject, config, dry_run)
_update_changelog(config, dry_run)

print("Do not forget to update the api version compatibilities")


if __name__ == "__main__":
Expand Down

0 comments on commit 9070b66

Please sign in to comment.