Skip to content

Commit 0e8a094

Browse files
fix: update backend bump automation
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
1 parent d303728 commit 0e8a094

8 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/workflows/CI.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
permissions:
1819
contents: write

.github/workflows/CI_Windows.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_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: 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/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: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
schedule:
44
- cron: '00 00 * * *'
55
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
actions: write
11+
612
jobs:
713
update_compat:
814
runs-on: ubuntu-latest
@@ -34,20 +40,36 @@ jobs:
3440
run: |
3541
if git diff --quiet pysr/juliapkg.json; then
3642
echo "No changes to pysr/juliapkg.json. Restoring changes."
37-
git restore pyproject.toml
43+
git restore pyproject.toml .release-please-manifest.json
3844
fi
3945
4046
- name: "Create PR if necessary"
47+
id: cpr
4148
uses: peter-evans/create-pull-request@v8
4249
with:
4350
branch: backend-update/v${{ steps.get-latest.outputs.version }}
44-
title: "Automated update to backend: v${{ steps.get-latest.outputs.version }}"
51+
title: "chore: update backend to v${{ steps.get-latest.outputs.version }}"
4552
body: |
4653
This PR was automatically generated by the GitHub Action `.github/workflows/update-backend.yml`
4754
4855
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 }}).
4956
delete-branch: true
50-
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 }}"
5158
add-paths: |
59+
.release-please-manifest.json
5260
pyproject.toml
5361
pysr/juliapkg.json
62+
63+
- name: "Trigger CI workflows (backend update PR)"
64+
if: steps.cpr.outputs.pull-request-number != ''
65+
env:
66+
GH_TOKEN: ${{ github.token }}
67+
run: |
68+
ref="backend-update/v${{ steps.get-latest.outputs.version }}"
69+
gh workflow run "Linux" --repo "$GITHUB_REPOSITORY" --ref "$ref" || true
70+
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)