@@ -65,255 +65,6 @@ jobs:
6565 # This allows re-running the workflow after partial failures
6666 uv publish --token "$UV_PUBLISH_TOKEN" --check-url https://pypi.org/simple/
6767 echo "✅ All packages built and published successfully!"
68-
69- create-version-bump-prs :
70- needs : publish
71- runs-on : ubuntu-24.04
72- if : github.event_name == 'release'
73- env :
74- VERSION : ${{ needs.publish.outputs.version }}
75- GH_TOKEN : ${{ secrets.ALLHANDS_BOT_GITHUB_PAT }}
76- steps :
77- - name : Validate version
78- run : |
79- if [ -z "$VERSION" ]; then
80- echo "❌ Version is empty"
81- exit 1
82- fi
83- echo "📦 Creating version bump PRs for version: $VERSION"
84-
85- - name : Wait for packages to be available on PyPI
86- run : |
87- set -euo pipefail
88-
89- PACKAGES=(
90- openhands-sdk
91- openhands-tools
92- openhands-workspace
93- openhands-agent-server
94- )
95-
96- MAX_ATTEMPTS=60
97- SLEEP_SECONDS=20
98-
99- echo "⏳ Waiting for packages to be available on PyPI..."
100-
101- for PKG in "${PACKAGES[@]}"; do
102- echo "Checking $PKG==$VERSION..."
103- ATTEMPT=1
104- while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
105- # Check if the package version is available on PyPI
106- HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
107- "https://pypi.org/pypi/$PKG/$VERSION/json")
108-
109- if [ "$HTTP_CODE" = "200" ]; then
110- echo "✅ $PKG==$VERSION is available on PyPI"
111- break
112- fi
113-
114- echo " Attempt $ATTEMPT/$MAX_ATTEMPTS: $PKG==$VERSION not yet available (HTTP $HTTP_CODE), waiting ${SLEEP_SECONDS}s..."
115- sleep $SLEEP_SECONDS
116- ATTEMPT=$((ATTEMPT + 1))
117- done
118-
119- if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
120- echo "❌ Timeout waiting for $PKG==$VERSION to be available on PyPI"
121- exit 1
122- fi
123- done
124-
125- echo "✅ All packages are available on PyPI!"
126-
127- - name : Install uv
128- uses : astral-sh/setup-uv@v7
129- with :
130- version : latest
131- python-version : ' 3.12'
132-
133- - name : Install Poetry
134- run : |
135- pipx install poetry
136-
137- # OpenHands-CLI step runs first since it's simpler and less error-prone
138- - name : Create PR for OpenHands-CLI repo
139- run : |
140- set -euo pipefail
141-
142- REPO="OpenHands/openhands-cli"
143- BRANCH="bump-sdk-$VERSION"
144-
145- echo "🔄 Creating PR for $REPO..."
146-
147- # Clone the repo
148- git clone "https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git" openhands-cli-repo
149- cd openhands-cli-repo
150-
151- # Configure git
152- git config user.name "github-actions[bot]"
153- git config user.email "github-actions[bot]@users.noreply.github.com"
154-
155- # Create branch
156- git checkout -b "$BRANCH"
157-
158- # Update versions using uv
159- uv add "openhands-sdk==$VERSION" "openhands-tools==$VERSION"
160-
161- # Check if there are changes
162- if git diff --quiet; then
163- echo "⚠️ No changes detected in $REPO - versions may already be up to date"
164- exit 0
165- fi
166-
167- # Commit and push
168- git add pyproject.toml uv.lock
169- git commit -m "Bump openhands-sdk, openhands-tools to $VERSION" \
170- -m "Automated version bump after PyPI release." \
171- -m "Co-authored-by: openhands <openhands@all-hands.dev>"
172- git push -u origin "$BRANCH"
173-
174- # Create PR
175- gh pr create \
176- --repo "$REPO" \
177- --title "Bump SDK packages to v$VERSION" \
178- --body "## Automated Version Bump
179-
180- This PR updates the following packages to version **$VERSION**:
181- - \`openhands-sdk\`
182- - \`openhands-tools\`
183-
184- **Triggered by:** Release of [software-agent-sdk v$VERSION](https://github.com/OpenHands/software-agent-sdk/releases/tag/v$VERSION)
185-
186- ---
187- _This PR was automatically created by the pypi-release workflow._" \
188- --base main \
189- --head "$BRANCH"
190-
191- echo "✅ PR created for $REPO"
192-
193- - name : Create PR for OpenHands repo
194- run : |
195- set -euo pipefail
196-
197- REPO="All-Hands-AI/OpenHands"
198- BRANCH="bump-sdk-$VERSION"
199-
200- echo "🔄 Creating PR for $REPO..."
201-
202- # Clone the repo
203- git clone "https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git" openhands-repo
204- cd openhands-repo
205-
206- # Configure git
207- git config user.name "github-actions[bot]"
208- git config user.email "github-actions[bot]@users.noreply.github.com"
209-
210- # Create branch
211- git checkout -b "$BRANCH"
212-
213- # Get the git hash from the release branch in software-agent-sdk
214- SDK_COMMIT_HASH=$(git ls-remote https://github.com/OpenHands/software-agent-sdk.git "refs/tags/v$VERSION" | cut -c1-7)
215- if [ -z "$SDK_COMMIT_HASH" ]; then
216- echo "⚠️ Could not find commit hash for tag v$VERSION, using full version"
217- SDK_COMMIT_HASH="$VERSION"
218- fi
219- echo "📦 SDK commit hash: $SDK_COMMIT_HASH"
220-
221- # 1. Update versions in pyproject.toml using poetry (root)
222- # Use --lock to only update pyproject.toml without modifying lock file
223- echo "📝 Updating root pyproject.toml..."
224- poetry add --lock "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION"
225-
226- # 2. Update versions in enterprise/pyproject.toml using poetry
227- # Use --lock to only update pyproject.toml without modifying lock file
228- echo "📝 Updating enterprise/pyproject.toml..."
229- cd enterprise
230- poetry add --lock "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION"
231- cd ..
232-
233- # 3. Generate poetry.lock in root (regenerate from scratch)
234- echo "🔒 Running poetry lock in root..."
235- poetry lock --no-update
236-
237- # 4. Generate poetry.lock in enterprise directory (regenerate from scratch)
238- echo "🔒 Running poetry lock in enterprise/..."
239- cd enterprise
240- poetry lock --no-update
241- cd ..
242-
243- # 5. Update the hash in sandbox_spec_service.py
244- echo "🔧 Updating AGENT_SERVER_IMAGE hash..."
245- SANDBOX_SPEC_FILE="openhands/app_server/sandbox/sandbox_spec_service.py"
246- if [ -f "$SANDBOX_SPEC_FILE" ]; then
247- # Update the AGENT_SERVER_IMAGE line with the new hash
248- sed -i "s|AGENT_SERVER_IMAGE = 'ghcr.io/openhands/agent-server:[^']*'|AGENT_SERVER_IMAGE = 'ghcr.io/openhands/agent-server:${SDK_COMMIT_HASH}-python'|" "$SANDBOX_SPEC_FILE"
249- echo "✅ Updated AGENT_SERVER_IMAGE to: ghcr.io/openhands/agent-server:${SDK_COMMIT_HASH}-python"
250- else
251- echo "❌ sandbox_spec_service.py not found at expected path"
252- exit 1
253- fi
254-
255- # Check if there are changes
256- if git diff --quiet; then
257- echo "⚠️ No changes detected in $REPO - versions may already be up to date"
258- exit 0
259- fi
260-
261- # Commit and push
262- git add .
263- git commit -m "Bump openhands-sdk, openhands-tools, openhands-agent-server to $VERSION" \
264- -m "Automated version bump after PyPI release." \
265- -m "" \
266- -m "Changes:" \
267- -m "- Updated SDK packages to v$VERSION in pyproject.toml" \
268- -m "- Updated SDK packages to v$VERSION in enterprise/pyproject.toml" \
269- -m "- Regenerated poetry.lock" \
270- -m "- Regenerated enterprise/poetry.lock" \
271- -m "- Updated AGENT_SERVER_IMAGE hash to ${SDK_COMMIT_HASH}" \
272- -m "" \
273- -m "Co-authored-by: openhands <openhands@all-hands.dev>"
274- git push -u origin "$BRANCH"
275-
276- # Create PR
277- gh pr create \
278- --repo "$REPO" \
279- --title "Bump SDK packages to v$VERSION" \
280- --body "## Automated Version Bump
281-
282- This PR updates the following packages to version **$VERSION**:
283- - \`openhands-sdk\`
284- - \`openhands-tools\`
285- - \`openhands-agent-server\`
286-
287- ### Changes
288- - Updated SDK packages in \`pyproject.toml\`
289- - Updated SDK packages in \`enterprise/pyproject.toml\`
290- - Regenerated \`poetry.lock\`
291- - Regenerated \`enterprise/poetry.lock\`
292- - Updated \`AGENT_SERVER_IMAGE\` hash to \`${SDK_COMMIT_HASH}\` in \`sandbox_spec_service.py\`
293-
294- **Triggered by:** Release of [software-agent-sdk v$VERSION](https://github.com/OpenHands/software-agent-sdk/releases/tag/v$VERSION)
295-
296- ---
297- _This PR was automatically created by the pypi-release workflow._" \
298- --base main \
299- --head "$BRANCH"
300-
301- echo "✅ PR created for $REPO"
302-
303- - name : Summary
304- run : |
305- echo "## ✅ Version Bump PRs Created" >> $GITHUB_STEP_SUMMARY
306- echo "" >> $GITHUB_STEP_SUMMARY
307- echo "PRs have been created to bump SDK packages to version **$VERSION**:" >> $GITHUB_STEP_SUMMARY
308- echo "" >> $GITHUB_STEP_SUMMARY
309- echo "- [OpenHands](https://github.com/All-Hands-AI/OpenHands/pulls?q=is%3Apr+bump-sdk-$VERSION)" >> $GITHUB_STEP_SUMMARY
310- echo "- [OpenHands-CLI](https://github.com/All-Hands-AI/openhands-cli/pulls?q=is%3Apr+bump-sdk-$VERSION)" >> $GITHUB_STEP_SUMMARY
311-
312- - name : Notify Slack
313- uses : slackapi/slack-github-action@v2.1.1
314- with :
315- method : chat.postMessage
316- token : ${{ secrets.SLACK_BOT_TOKEN }}
317- payload : |
318- channel: C08E1SYKEM9
319- text: "🚀 *SDK v${{ env.VERSION }} published to PyPI!*\n\nVersion bump PRs created:\n• <https://github.com/All-Hands-AI/OpenHands/pulls?q=is%3Apr+bump-sdk-${{ env.VERSION }}|OpenHands>\n• <https://github.com/All-Hands-AI/openhands-cli/pulls?q=is%3Apr+bump-sdk-${{ env.VERSION }}|OpenHands-CLI>\n\n<https://github.com/OpenHands/software-agent-sdk/releases/tag/v${{ env.VERSION }}|View Release>"
68+ echo ""
69+ echo "📋 Note: Version bump PRs will be created by the 'Create Version Bump PRs' workflow"
70+ echo " which triggers automatically after this workflow completes."
0 commit comments