Skip to content

Commit f1963a4

Browse files
chore: keep release-please manifest on released prerelease (#1185)
* fix: keep prerelease manifest unchanged Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com> * fix: keep release-please state release-managed Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com> --------- Co-authored-by: MilesCranmerBot <milescranmerbot@users.noreply.github.com> Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
1 parent 912c4c2 commit f1963a4

3 files changed

Lines changed: 3 additions & 69 deletions

File tree

.github/workflows/update_backend.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ jobs:
2020
cache: pip
2121

2222
- name: "Install dependencies"
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install tomlkit
23+
run: python -m pip install --upgrade pip
2624

2725
- name: "Get SymbolicRegression.jl latest version"
2826
id: get-latest
@@ -36,13 +34,6 @@ jobs:
3634
run: |
3735
python .github/workflows/update_backend_version.py ${{ steps.get-latest.outputs.version }}
3836
39-
- name: "Restore changes if no diff to `pysr/juliapkg.json`"
40-
run: |
41-
if git diff --quiet pysr/juliapkg.json; then
42-
echo "No changes to pysr/juliapkg.json. Restoring changes."
43-
git restore pyproject.toml .release-please-manifest.json
44-
fi
45-
4637
- name: "Create PR if necessary"
4738
id: cpr
4839
uses: peter-evans/create-pull-request@v8
@@ -56,8 +47,6 @@ jobs:
5647
delete-branch: true
5748
commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}"
5849
add-paths: |
59-
.release-please-manifest.json
60-
pyproject.toml
6150
pysr/juliapkg.json
6251
6352
- name: "Trigger CI workflows (backend update PR)"
Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,17 @@
11
import json
2-
import re
32
import sys
43
from pathlib import Path
54

6-
import tomlkit
7-
85
new_backend_version = sys.argv[1]
96

107
assert not new_backend_version.startswith("v"), "Version should not start with 'v'"
118

129
repo_root = Path(__file__).parent / ".." / ".."
13-
pyproject_toml = repo_root / "pyproject.toml"
1410
juliapkg_json = repo_root / "pysr" / "juliapkg.json"
15-
release_please_manifest = repo_root / ".release-please-manifest.json"
16-
17-
with open(pyproject_toml) as toml_file:
18-
pyproject_data = tomlkit.parse(toml_file.read())
19-
2011
with open(juliapkg_json) as f:
2112
juliapkg_data = json.load(f)
2213

23-
with open(release_please_manifest) as f:
24-
release_please_manifest_data = json.load(f)
25-
26-
current_version = pyproject_data["project"]["version"]
27-
parts = current_version.split(".")
28-
29-
if len(parts) < 3:
30-
raise ValueError(
31-
f"Invalid version format: {current_version}. Expected at least 3 components (major.minor.patch)"
32-
)
33-
34-
major, minor = parts[0], parts[1]
35-
36-
patch_match = re.match(r"^(\d+)(.*)$", parts[2])
37-
if not patch_match:
38-
raise ValueError(
39-
f"Could not parse patch version from '{parts[2]}' in version {current_version}. "
40-
f"Expected patch to start with a number (e.g., '0', '1a1', '2rc3')"
41-
)
42-
43-
patch_num_str, patch_suffix = patch_match.groups()
44-
patch_num = int(patch_num_str)
45-
46-
pre_release_match = re.fullmatch(r"(a|b|rc)(\d+)", patch_suffix)
47-
if pre_release_match:
48-
pre_tag, pre_num = pre_release_match.groups()
49-
new_patch = patch_num
50-
new_suffix = f"{pre_tag}{int(pre_num) + 1}"
51-
else:
52-
new_patch = patch_num + 1
53-
new_suffix = patch_suffix
54-
55-
# Add back any additional version components (e.g., "2.0.0.dev1" -> ".dev1")
56-
extra_parts = "." + ".".join(parts[3:]) if len(parts) > 3 else ""
57-
new_version = f"{major}.{minor}.{new_patch}{new_suffix}{extra_parts}"
58-
59-
pyproject_data["project"]["version"] = new_version
60-
release_please_manifest_data["."] = new_version
61-
62-
# Update backend - maintain current format (either "rev" or "version")
14+
# Update backend, maintain current format (either "rev" or "version")
6315
backend_pkg = juliapkg_data["packages"]["SymbolicRegression"]
6416
if "rev" in backend_pkg:
6517
backend_pkg["rev"] = f"v{new_backend_version}"
@@ -70,13 +22,6 @@
7022
"SymbolicRegression package must have either 'rev' or 'version' field"
7123
)
7224

73-
with open(pyproject_toml, "w") as toml_file:
74-
toml_file.write(tomlkit.dumps(pyproject_data))
75-
7625
with open(juliapkg_json, "w") as f:
7726
json.dump(juliapkg_data, f, indent=4)
7827
f.write("\n")
79-
80-
with open(release_please_manifest, "w") as f:
81-
json.dump(release_please_manifest_data, f, indent=2)
82-
f.write("\n")

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.0.0a2"
2+
".": "2.0.0a1"
33
}

0 commit comments

Comments
 (0)