INNER CODE UNIT · Python
roll_pubspec_calendar
fluxerapp/flutter_client · .github/scripts/app_version.py:102
def roll_pubspec_calendar(now: datetime | None = None, path: Path = PUBSPEC_PATH) -> tuple[bool, AppVersion]:
if now is None:
now = datetime.now(timezone.utc)
current = read_pubspec_version(path)
next_version = calendar_version_for(now, current)
if _pubspec_version_value(path) == next_version.pubspec_value:
return False, next_version
write_pubspec_version(next_version, path)
return True, next_version
def _write_github_output(*, changed: bool, version: AppVersion) -> None:
github_output = os.environ.get("GITHUB_OUTPUT", "").strip()
if github_output == "":
return
with open(github_output, "a", encoding="utf-8") as handle:
handle.write(f"changed={'true' if changed else 'false'}\n")
handle.write(f"version={version.name}\n")