diff --git a/README.md b/README.md index 115244a..8396c56 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,14 @@ Eventually, pushing the release tag to origin is what triggers `release.yml`, which builds and publishes to PyPI. Nothing is uploaded from a developer machine and no PyPI token exists anywhere. +A repository that publishes no package, but release files of its own, +names itself in its root `pyproject.toml`, and may name a file that carries its version, +which the release commit then sets beside CHANGELOG.md: + + [tool.make-new-release] + name = "cmrelay" + version-file = "host/VERSION" + ## PyPI trusted publishing (OIDC) setup diff --git a/scripts/make_new_release.py b/scripts/make_new_release.py index c2021ce..9adfe40 100755 --- a/scripts/make_new_release.py +++ b/scripts/make_new_release.py @@ -69,9 +69,14 @@ def read_pyproject(): return tomllib.load(f) +def release_settings(): + """[tool.make-new-release]: `name` and `version-file` of a repo without a package.""" + return read_pyproject().get("tool", {}).get("make-new-release", {}) + + def get_project_name(): """Reads the project name from pyproject.toml.""" - return read_pyproject()["project"]["name"] + return release_settings().get("name") or read_pyproject()["project"]["name"] def get_test_dependencies(): @@ -464,6 +469,10 @@ def main(): return changed = update_changelog(tag) + if version_file := release_settings().get("version-file"): + Path(version_file).write_text(f"{next_ver}\n") + run(["git", "add", version_file]) + changed = True if changed: run(["git", "add", "CHANGELOG.md"]) if run(["git", "commit", "-m", f"chore: release {tag}"]) != 0: