diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2308df4..31df6109 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: - name: (MacOS) Update manifest if: matrix.os == 'macos-latest' && startsWith(github.ref, 'refs/tags/v') run: | - python ./scripts/update-manifest.py --target darwin + python3 ./scripts/update-manifest.py --target darwin # remove unused manifests rm manifests/update-linux.json manifests/update-windows.json diff --git a/.releaserc.json b/.releaserc.json index cdd882ff..8b56a708 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -6,7 +6,7 @@ [ "@semantic-release/exec", { - "prepareCmd": "python ./scripts/update-manifest.py --target all --version ${nextRelease.version} --notes \"${nextRelease.notes}\"" + "prepareCmd": "python3 ./scripts/update-manifest.py --target all --version ${nextRelease.version} --notes \"${nextRelease.notes}\"" } ], [ diff --git a/scripts/update-manifest.py b/scripts/update-manifest.py index 767a6d61..07bc9bab 100755 --- a/scripts/update-manifest.py +++ b/scripts/update-manifest.py @@ -100,11 +100,23 @@ def update_target(target): if target in ["windows", "all"]: update_target("windows") -#update toml -# if version: -# new_version = [] -# with open("./src-tauri/Cargo.toml", "r") as f: -# new_version = f.readlines() -# new_version[2] = f'version = "{version}"\n' -# with open("./src-tauri/Cargo.toml", "w") as f: -# f.writelines(new_version) \ No newline at end of file + +if version: + # update package.json + package_json = json.loads(Path("./package.json").read_text()) + package_json["version"] = version + Path("./package.json").write_text(json.dumps(package_json, indent=2)) + + # update tauri.conf.json + package_json = json.loads(Path("./src-tauri/tauri.conf.json").read_text()) + package_json["package"]["version"] = version + Path("./src-tauri/tauri.conf.json").write_text(json.dumps(package_json, indent=2)) + + #update toml + #todo: this invalidates the cache + # new_version = [] + # with open("./src-tauri/Cargo.toml", "r") as f: + # new_version = f.readlines() + # new_version[2] = f'version = "{version}"\n' + # with open("./src-tauri/Cargo.toml", "w") as f: + # f.writelines(new_version) \ No newline at end of file