Skip to content

Commit

Permalink
build: update version in package configs when release
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewinci committed Oct 16, 2022
1 parent 0d48844 commit 445caff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}\""
}
],
[
Expand Down
28 changes: 20 additions & 8 deletions scripts/update-manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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)

0 comments on commit 445caff

Please sign in to comment.