Skip to content

Add logic to auto update release version in package after a release is cut #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

markurtz
Copy link
Member

@markurtz markurtz commented May 1, 2025

No description provided.

@markurtz markurtz requested review from sjmonson and Copilot May 1, 2025 14:19
@markurtz markurtz self-assigned this May 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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
Copy link
Preview

Copilot AI May 1, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This does seem a little fragile. Maybe instead have the workflow open a PR and tag some reviewers?

📦 Build Artifacts Available
The build artifacts (.whl and .tar.gz) have been successfully generated and are available for download: https://github.com/neuralmagic/guidellm/actions/runs/14776962064/artifacts/3044707564.
They will be retained for up to 30 days.

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does seem a little fragile. Maybe instead have the workflow open a PR and tag some reviewers?

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