Files
materialious/update_versions.py
T
Ward 948e6951d8 Update/1.10.11 (#1109)
* Bump version

* Froce player id

* Improved implementation of SABR

* More SABR changes

* Minor catch for event listener

* Bump tar-fs from 3.0.9 to 3.1.1 in /materialious

Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 3.0.9 to 3.1.1.
- [Commits](https://github.com/mafintosh/tar-fs/compare/v3.0.9...v3.1.1)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-version: 3.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump electron from 38.1.0 to 38.1.2 in /materialious/electron

---
updated-dependencies:
- dependency-name: electron
  dependency-version: 38.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @capacitor/core from 7.4.2 to 7.4.3 in /materialious

Bumps [@capacitor/core](https://github.com/ionic-team/capacitor) from 7.4.2 to 7.4.3.
- [Release notes](https://github.com/ionic-team/capacitor/releases)
- [Changelog](https://github.com/ionic-team/capacitor/blob/7.4.3/CHANGELOG.md)
- [Commits](https://github.com/ionic-team/capacitor/compare/7.4.2...7.4.3)

---
updated-dependencies:
- dependency-name: "@capacitor/core"
  dependency-version: 7.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump human-number from 2.0.4 to 2.0.6 in /materialious

Bumps [human-number](https://github.com/Kikobeats/human-number) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/Kikobeats/human-number/releases)
- [Changelog](https://github.com/Kikobeats/human-number/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Kikobeats/human-number/compare/v2.0.4...v2.0.6)

---
updated-dependencies:
- dependency-name: human-number
  dependency-version: 2.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @vite-pwa/sveltekit from 0.6.8 to 1.0.0 in /materialious

Bumps [@vite-pwa/sveltekit](https://github.com/vite-pwa/sveltekit) from 0.6.8 to 1.0.0.
- [Release notes](https://github.com/vite-pwa/sveltekit/releases)
- [Commits](https://github.com/vite-pwa/sveltekit/compare/v0.6.8...v1.0.0)

---
updated-dependencies:
- dependency-name: "@vite-pwa/sveltekit"
  dependency-version: 1.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package.json

* Dispose of adapter correctly

* Minor improvements

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-25 01:47:21 +00:00

75 lines
2.4 KiB
Python

import json
import os
import re
from datetime import datetime
LATEST_VERSION = "1.10.11"
RELEASE_DATE = datetime.now().strftime("%Y-%-m-%d") # Format: YYYY-M-D
WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious")
ROOT_PACKAGE = os.path.join(WORKING_DIR, "package.json")
ELECTRON_PACKAGE = os.path.join(WORKING_DIR, "electron", "package.json")
ANDROID_PACKAGE = os.path.join(WORKING_DIR, "android", "app", "build.gradle")
METAINFO_FILE = os.path.join(WORKING_DIR, "electron", "materialious.metainfo.xml")
def package_json_update_ver(location: str) -> None:
with open(location, "r") as f_:
package = json.load(f_)
if package["version"] == LATEST_VERSION:
return
package["version"] = LATEST_VERSION
with open(location, "w") as f_:
json.dump(package, f_, indent="\t")
def update_android_version() -> None:
with open(ANDROID_PACKAGE, "r") as f_:
contents = f_.read()
version_code_match = re.search(r"versionCode\s+(\d+)", contents)
version_name_match = re.search(r'versionName\s+"([^"]+)"', contents)
if version_code_match and version_name_match:
version_code = int(version_code_match.group(1)) + 1
contents = re.sub(r"versionCode\s+\d+", f"versionCode {version_code}", contents)
contents = re.sub(
r'versionName\s+"[^"]+"',
f'versionName "{LATEST_VERSION}"',
contents,
)
with open(ANDROID_PACKAGE, "w") as f_:
f_.write(contents)
def update_metainfo_release() -> None:
with open(METAINFO_FILE, "r") as f_:
contents = f_.read()
# Check if the version already exists in the releases
if re.search(rf'<release version="{re.escape(LATEST_VERSION)}"', contents):
print(f"Release version {LATEST_VERSION} already exists.")
return
new_release = f"""
<release version="{LATEST_VERSION}" date="{RELEASE_DATE}">
<url>https://github.com/Materialious/Materialious/releases/tag/{LATEST_VERSION}</url>
</release>"""
# Insert the new release after the opening <releases> tag
updated_contents = re.sub(r"(<releases>\s*)", rf"\1{new_release}\n", contents)
with open(METAINFO_FILE, "w") as f_:
f_.write(updated_contents)
if __name__ == "__main__":
for location in (ROOT_PACKAGE, ELECTRON_PACKAGE):
package_json_update_ver(location)
update_android_version()
update_metainfo_release()