Skip to content

Commit 68de225

Browse files
fix: keep release-please state release-managed
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
1 parent b146cb1 commit 68de225

3 files changed

Lines changed: 3 additions & 57 deletions

File tree

.github/workflows/update_backend.yml

Lines changed: 1 addition & 11 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
44-
fi
45-
4637
- name: "Create PR if necessary"
4738
id: cpr
4839
uses: peter-evans/create-pull-request@v8
@@ -56,7 +47,6 @@ jobs:
5647
delete-branch: true
5748
commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}"
5849
add-paths: |
59-
pyproject.toml
6050
pysr/juliapkg.json
6151
6252
- name: "Trigger CI workflows (backend update PR)"
Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +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-
with open(pyproject_toml) as toml_file:
16-
pyproject_data = tomlkit.parse(toml_file.read())
17-
1811
with open(juliapkg_json) as f:
1912
juliapkg_data = json.load(f)
2013

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

66-
with open(pyproject_toml, "w") as toml_file:
67-
toml_file.write(tomlkit.dumps(pyproject_data))
68-
6925
with open(juliapkg_json, "w") as f:
7026
json.dump(juliapkg_data, f, indent=4)
7127
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)