diff --git a/.github/workflows/version-bump-prs.yml b/.github/workflows/version-bump-prs.yml index ebb82ffdbe..57a7978ae9 100644 --- a/.github/workflows/version-bump-prs.yml +++ b/.github/workflows/version-bump-prs.yml @@ -91,10 +91,6 @@ jobs: echo "āœ… All packages are resolvable on PyPI!" - - name: Install Poetry - run: | - pipx install poetry==2.3.3 - # OpenHands-CLI step runs first since it's simpler and less error-prone - name: Create PR for OpenHands-CLI repo env: @@ -178,7 +174,7 @@ jobs: run: | set -euo pipefail - REPO="All-Hands-AI/OpenHands" + REPO="OpenHands/OpenHands" BRANCH="bump-sdk-$VERSION" echo "šŸ”„ Creating PR for $REPO..." @@ -201,6 +197,17 @@ jobs: git checkout -b "$BRANCH" fi + # Match the base branch's lockfile generator so reruns can + # repair any existing bump branch that used a newer Poetry. + POETRY_VERSION=$(git show origin/main:poetry.lock | sed -n -E 's/^# This file is automatically @generated by Poetry ([^ ]+) and should not be changed by hand\.$/\1/p') + if [ -z "$POETRY_VERSION" ]; then + echo "āŒ Could not determine Poetry version from poetry.lock" + exit 1 + fi + echo "šŸ“¦ Installing Poetry $POETRY_VERSION from poetry.lock..." + pipx install "poetry==$POETRY_VERSION" + poetry --version + # 1. Update versions in pyproject.toml and poetry.lock using poetry (root) # The --lock flag updates both pyproject.toml AND poetry.lock # Note: enterprise/pyproject.toml gets these dependencies transitively via openhands-ai @@ -230,11 +237,21 @@ jobs: # inconsistencies between [tool.poetry.dependencies] and [project].dependencies echo "šŸ“ Updating pyproject.toml with exact version pins..." + PYPROJECT_FMT_CONFIG="dev_config/python/.pre-commit-config.yaml" + if [ ! -f "$PYPROJECT_FMT_CONFIG" ]; then + echo "āŒ pyproject-fmt config not found at expected path" + exit 1 + fi + if ! grep -q "args: \\[--keep-full-version\\]" "$PYPROJECT_FMT_CONFIG"; then + sed -i '/^[[:space:]]*- id: pyproject-fmt[[:space:]]*$/a\ args: [--keep-full-version]' "$PYPROJECT_FMT_CONFIG" + echo "āœ… Configured pyproject-fmt to preserve full versions" + fi + # Update [tool.poetry.dependencies] section # Matches: openhands-sdk = "1.13" or openhands-sdk = "1.13.0" - sed -i -E 's/^(openhands-sdk = )"[^"]*"/\1"'"$VERSION"'"/' pyproject.toml - sed -i -E 's/^(openhands-tools = )"[^"]*"/\1"'"$VERSION"'"/' pyproject.toml - sed -i -E 's/^(openhands-agent-server = )"[^"]*"/\1"'"$VERSION"'"/' pyproject.toml + sed -i -E 's/^(openhands-sdk = )"[^"]*"/\1"=='"$VERSION"'"/' pyproject.toml + sed -i -E 's/^(openhands-tools = )"[^"]*"/\1"=='"$VERSION"'"/' pyproject.toml + sed -i -E 's/^(openhands-agent-server = )"[^"]*"/\1"=='"$VERSION"'"/' pyproject.toml # Update [project].dependencies section (PEP 621 format) # Matches: "openhands-sdk==1.13.1", or "openhands-sdk==1.13", @@ -262,10 +279,10 @@ jobs: exit 1 fi - # 4. Run pre-commit to fix formatting (pyproject-fmt removes parentheses from version specs) + # 4. Run pre-commit to fix formatting with the target repo's config. echo "šŸ”§ Running pre-commit to fix formatting..." pip install pre-commit - pre-commit run --files pyproject.toml --config ./dev_config/python/.pre-commit-config.yaml || true + pre-commit run --files pyproject.toml "$PYPROJECT_FMT_CONFIG" --config ./dev_config/python/.pre-commit-config.yaml || true # Check if there are changes if git diff --quiet; then @@ -274,12 +291,12 @@ jobs: fi # Commit and push - git add . + git add pyproject.toml poetry.lock "$SANDBOX_SPEC_FILE" "$PYPROJECT_FMT_CONFIG" git commit -m "Bump openhands-sdk, openhands-tools, openhands-agent-server to $VERSION" \ -m "Automated version bump after PyPI release." \ -m "" \ -m "Changes:" \ - -m "- Updated SDK packages to v$VERSION in pyproject.toml" \ + -m "- Updated SDK packages to v$VERSION with exact pins in pyproject.toml" \ -m "- Regenerated poetry.lock" \ -m "- Updated AGENT_SERVER_IMAGE to ${VERSION}" \ -m "" \ @@ -303,8 +320,8 @@ jobs: - \`openhands-agent-server\` ### Changes - - Updated SDK packages in \`pyproject.toml\` - - Regenerated \`poetry.lock\` + - Updated SDK packages in \`pyproject.toml\` with exact pins + - Regenerated \`poetry.lock\` with the target repo's Poetry version - Updated \`AGENT_SERVER_IMAGE\` to \`${VERSION}\` in \`sandbox_spec_service.py\` **Triggered by:** Release of [software-agent-sdk v$VERSION](https://github.com/OpenHands/software-agent-sdk/releases/tag/v$VERSION) @@ -325,7 +342,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "PRs have been created to bump SDK packages to version **$VERSION**:" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - echo "- [OpenHands](https://github.com/All-Hands-AI/OpenHands/pulls?q=is%3Apr+bump-sdk-$VERSION)" >> $GITHUB_STEP_SUMMARY + echo "- [OpenHands](https://github.com/OpenHands/OpenHands/pulls?q=is%3Apr+bump-sdk-$VERSION)" >> $GITHUB_STEP_SUMMARY echo "- [OpenHands-CLI](https://github.com/OpenHands/openhands-cli/pulls?q=is%3Apr+bump-sdk-$VERSION)" >> $GITHUB_STEP_SUMMARY - name: Notify Slack @@ -336,4 +353,4 @@ jobs: token: ${{ env.SLACK_BOT_TOKEN }} payload: | channel: C08E1SYKEM9 - text: "šŸš€ *SDK v${{ steps.get_version.outputs.version }} published to PyPI!*\n\nVersion bump PRs created:\n• \n• \n\n" + text: "šŸš€ *SDK v${{ steps.get_version.outputs.version }} published to PyPI!*\n\nVersion bump PRs created:\n• \n• \n\n"