Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions .github/workflows/version-bump-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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..."
Expand All @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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 "" \
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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• <https://github.com/All-Hands-AI/OpenHands/pulls?q=is%3Apr+bump-sdk-${{ steps.get_version.outputs.version }}|OpenHands>\n• <https://github.com/OpenHands/openhands-cli/pulls?q=is%3Apr+bump-sdk-${{ steps.get_version.outputs.version }}|OpenHands-CLI>\n\n<https://github.com/OpenHands/software-agent-sdk/releases/tag/v${{ steps.get_version.outputs.version }}|View Release>"
text: "🚀 *SDK v${{ steps.get_version.outputs.version }} published to PyPI!*\n\nVersion bump PRs created:\n• <https://github.com/OpenHands/OpenHands/pulls?q=is%3Apr+bump-sdk-${{ steps.get_version.outputs.version }}|OpenHands>\n• <https://github.com/OpenHands/openhands-cli/pulls?q=is%3Apr+bump-sdk-${{ steps.get_version.outputs.version }}|OpenHands-CLI>\n\n<https://github.com/OpenHands/software-agent-sdk/releases/tag/v${{ steps.get_version.outputs.version }}|View Release>"
Loading