Add logic to auto update release version in package after a release is cut#143
Add logic to auto update release version in package after a release is cut#143
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds an auto-update mechanism for the release version in the package after a release is cut. It updates the version in setup.py and introduces a new GitHub Actions job to automatically commit and push this update.
- Bump generated release version in setup.py.
- Add a new update-main-version job in the release workflow.
- Include steps for checking version differences and updating the repository accordingly.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| setup.py | Bumped LAST_RELEASE_VERSION from "0.0.0" to "0.2.1". |
| .github/workflows/release.yml | Added job to automatically update setup.py with the new release version. |
Comments suppressed due to low confidence (1)
.github/workflows/release.yml:76
- The grep command uses the -oP flag which relies on Perl-compatible regex; please ensure that the runner's environment supports this flag consistently, or consider a more portable alternative if necessary.
run: echo "setup_version=$(grep -oP 'LAST_RELEASE_VERSION = Version("\K[^"]+' setup.py)" >> $GITHUB_OUTPUT
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add setup.py | ||
| git commit -m "Update LAST_RELEASE_VERSION from $SETUP_VERSION to $TAG_VERSION" | ||
| git push origin main |
There was a problem hiding this comment.
The update job directly commits and pushes changes without handling concurrent updates, which might lead to merge conflicts. Consider adding a retry mechanism or merge strategy to address potential race conditions.
| git push origin main | |
| MAX_RETRIES=3 | |
| RETRY_COUNT=0 | |
| while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do | |
| git pull --rebase origin main || exit 1 | |
| if git push origin main; then | |
| echo "Push succeeded." | |
| break | |
| else | |
| echo "Push failed. Retrying... ($((RETRY_COUNT+1))/$MAX_RETRIES)" | |
| RETRY_COUNT=$((RETRY_COUNT+1)) | |
| sleep 5 | |
| fi | |
| done | |
| if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then | |
| echo "Push failed after $MAX_RETRIES attempts. Exiting." | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
This does seem a little fragile. Maybe instead have the workflow open a PR and tag some reviewers?
|
📦 Build Artifacts Available |
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add setup.py | ||
| git commit -m "Update LAST_RELEASE_VERSION from $SETUP_VERSION to $TAG_VERSION" | ||
| git push origin main |
There was a problem hiding this comment.
This does seem a little fragile. Maybe instead have the workflow open a PR and tag some reviewers?
No description provided.