Skip to content

Commit 066e1d3

Browse files
ci: fix backend bump automation (#1166)
Co-authored-by: MilesCranmerBot <milescranmerbot@users.noreply.github.com> Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
1 parent 6ae27e3 commit 066e1d3

File tree

8 files changed

+24
-10
lines changed

8 files changed

+24
-10
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
- 'master'
1414
paths:
1515
- '**'
16-
1716
workflow_dispatch:
1817

1918
permissions:

.github/workflows/CI_Windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
- 'master'
1414
paths:
1515
- '**'
16-
1716
workflow_dispatch:
1817

1918
jobs:

.github/workflows/CI_apptainer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- 'master'
1414
paths:
1515
- '**'
16+
workflow_dispatch:
1617

1718
jobs:
1819
test:

.github/workflows/CI_docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- 'master'
1414
paths:
1515
- '**'
16+
workflow_dispatch:
1617

1718
jobs:
1819
test:

.github/workflows/CI_mac.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ on:
1313
- 'master'
1414
paths:
1515
- '**'
16-
1716
workflow_dispatch:
1817

1918
jobs:

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches: [ "master" ]
99
schedule:
1010
- cron: '28 17 * * 1'
11+
workflow_dispatch:
1112

1213
jobs:
1314
analyze:

.github/workflows/update_backend.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,23 @@ jobs:
4040
run: |
4141
if git diff --quiet pysr/juliapkg.json; then
4242
echo "No changes to pysr/juliapkg.json. Restoring changes."
43-
git restore pyproject.toml
43+
git restore pyproject.toml .release-please-manifest.json
4444
fi
4545
4646
- name: "Create PR if necessary"
4747
id: cpr
4848
uses: peter-evans/create-pull-request@v8
4949
with:
5050
branch: backend-update/v${{ steps.get-latest.outputs.version }}
51-
title: "Automated update to backend: v${{ steps.get-latest.outputs.version }}"
51+
title: "chore: update backend to v${{ steps.get-latest.outputs.version }}"
5252
body: |
5353
This PR was automatically generated by the GitHub Action `.github/workflows/update-backend.yml`
5454
5555
It updates the backend version to v${{ steps.get-latest.outputs.version }}. For a full description of the changes, see the backend changelog: [v${{ steps.get-latest.outputs.version }}](https://github.com/MilesCranmer/SymbolicRegression.jl/releases/tag/v${{ steps.get-latest.outputs.version }}).
5656
delete-branch: true
57-
commit-message: "Update backend version to v${{ steps.get-latest.outputs.version }}"
57+
commit-message: "chore: update backend to v${{ steps.get-latest.outputs.version }}"
5858
add-paths: |
59+
.release-please-manifest.json
5960
pyproject.toml
6061
pysr/juliapkg.json
6162
@@ -66,5 +67,9 @@ jobs:
6667
run: |
6768
ref="backend-update/v${{ steps.get-latest.outputs.version }}"
6869
gh workflow run "Linux" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
69-
gh workflow run "macOS" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
7070
gh workflow run "Windows" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
71+
gh workflow run "macOS" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
72+
gh workflow run "Docker" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
73+
gh workflow run "Apptainer" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
74+
gh workflow run "Documentation" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
75+
gh workflow run "CodeQL" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true

.github/workflows/update_backend_version.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@
99

1010
assert not new_backend_version.startswith("v"), "Version should not start with 'v'"
1111

12-
pyproject_toml = Path(__file__).parent / ".." / ".." / "pyproject.toml"
13-
juliapkg_json = Path(__file__).parent / ".." / ".." / "pysr" / "juliapkg.json"
12+
repo_root = Path(__file__).parent / ".." / ".."
13+
pyproject_toml = repo_root / "pyproject.toml"
14+
juliapkg_json = repo_root / "pysr" / "juliapkg.json"
15+
release_please_manifest = repo_root / ".release-please-manifest.json"
1416

1517
with open(pyproject_toml) as toml_file:
1618
pyproject_data = tomlkit.parse(toml_file.read())
1719

1820
with open(juliapkg_json) as f:
1921
juliapkg_data = json.load(f)
2022

23+
with open(release_please_manifest) as f:
24+
release_please_manifest_data = json.load(f)
25+
2126
current_version = pyproject_data["project"]["version"]
2227
parts = current_version.split(".")
2328

@@ -52,6 +57,7 @@
5257
new_version = f"{major}.{minor}.{new_patch}{new_suffix}{extra_parts}"
5358

5459
pyproject_data["project"]["version"] = new_version
60+
release_please_manifest_data["."] = new_version
5561

5662
# Update backend - maintain current format (either "rev" or "version")
5763
backend_pkg = juliapkg_data["packages"]["SymbolicRegression"]
@@ -69,5 +75,8 @@
6975

7076
with open(juliapkg_json, "w") as f:
7177
json.dump(juliapkg_data, f, indent=4)
72-
# Ensure ends with newline
78+
f.write("\n")
79+
80+
with open(release_please_manifest, "w") as f:
81+
json.dump(release_please_manifest_data, f, indent=2)
7382
f.write("\n")

0 commit comments

Comments
 (0)