Skip to content

Automate python publishing on version bumps - #72

Merged
kmolan merged 3 commits into
mainfrom
feature/release-automation
Jun 7, 2026
Merged

Automate python publishing on version bumps#72
kmolan merged 3 commits into
mainfrom
feature/release-automation

Conversation

@kmolan

@kmolan kmolan commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Automate the Python release pipeline so a bonsai-py/Cargo.toml version bump on main
auto-tags + triggers publish.

  • Watches bonsai-py/Cargo.toml, pushes py-v$version
    on change. Uses a PAT (RELEASE_TAG_PAT) because GITHUB_TOKEN-pushed
    tags don't fire downstream workflows.

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TAG_PAT }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sollimann I need this from you. Steps:

  1. Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → "Generate new token".
  2. Token name: bonsai-release-tag (or anything memorable).
  3. Repository access: only sollimann/bonsai.
  4. Repository permissions:
    • Contents: Read and write (to push tags).
    • Actions: Read (to confirm workflow state, harmless if omitted).
  5. Expiration: on your discretion. The auto-tag flow will break silently when token expires. Ideally one year?
  6. Click "Generate token", copy the value immediately (you can't view it again).
  7. In the repo: Settings → Secrets and variables → Actions → "New repository secret":
    • Name: RELEASE_TAG_PAT
    • Value: paste the token.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done
image

Comment on lines +21 to +30
- name: Extract version from Cargo.toml
id: version
run: |
version=$(grep -m1 '^version' bonsai-py/Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$version" ]; then
echo "::error::Could not parse version from bonsai-py/Cargo.toml"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Detected version: $version"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so ideally we want the versions between Rust and Python match, but this model could break if we have e.g bug fixes/refactoring that only affects one or the other but that requires a new release version go get distributed. I haven't checked, but I'm pretty sure releases a immutable i.e you cannot update an existing version

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could operate on a model where we have version parity, and then only break them up if it becomes an actual problem. wdyt?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, version numbers are immutable. I would recommend keeping version numbers as XX.YY.ZZ, such that as long as XX.YY is the same, users are guaranteed to have same functionality. ZZ would only be reserved for the bugfixes you mentioned. When bumping ZZ, we must ensure that functionality-wise both are still the same. I don't think there's a clean way to automate this honestly. Version semantics are hard :/

@Sollimann Sollimann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Sollimann

Copy link
Copy Markdown
Owner

Please add a hyperlink and banner in the root README.md pointing to the package: https://pypi.org/project/bonsai-bt/

Can be a separate PR or just updating this one is fine too

@kmolan

kmolan commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

@Sollimann update README to add banner for pypi. Also bumped the version number patch so pypi gets updated. Its also worth doing so we can validated that yes changing version number actually updates the python bindings automatically.

@kmolan
kmolan merged commit 05ce285 into main Jun 7, 2026
10 checks passed
@kmolan
kmolan deleted the feature/release-automation branch June 7, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants