Skip to content

Prepare Release

Prepare Release #39

---
name: Prepare Release
on:
workflow_dispatch:
inputs:
version:
description: Release version (e.g., 1.2.3)
required: true
type: string
jobs:
prepare-release:
runs-on: ubuntu-24.04
steps:
- name: Validate version format
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid version format. Expected: X.Y.Z (e.g., 1.2.3)"
exit 1
fi
echo "✅ Version format is valid: ${{ inputs.version }}"
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_PUBLIC }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: latest
python-version: '3.13'
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create release branch
run: |
BRANCH_NAME="rel-${{ inputs.version }}"
echo "Creating branch: $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Set package version
run: |
echo "🔧 Setting version to ${{ inputs.version }}"
make set-package-version version=${{ inputs.version }}
- name: Update sdk_ref default in run-eval workflow
run: python3 .github/scripts/update_sdk_ref_default.py "${{ inputs.version }}"
- name: Commit version changes
run: |
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Release v${{ inputs.version }}" -m "Co-authored-by: openhands <openhands@all-hands.dev>"
echo "✅ Changes committed"
fi
- name: Push release branch
run: |
git push -u origin "${{ env.BRANCH_NAME }}"
echo "✅ Branch pushed: ${{ env.BRANCH_NAME }}"
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_PUBLIC }}
run: |
cat > pr_body.txt << 'EOF'
## Release v${{ inputs.version }}
This PR prepares the release for version **${{ inputs.version }}**.
### Release Checklist
- [x] Version set to ${{ inputs.version }}
- [ ] Fix any deprecation deadlines if they exist
- [ ] Integration tests pass (tagged with `integration-test`)
- [ ] Behavior tests pass (tagged with `behavior-test`)
- [ ] Example tests pass (tagged with `test-examples`)
- [ ] Evaluation on OpenHands Index
### What happens on merge
When this PR is merged, the `create-release.yml` workflow will automatically:
1. Create a GitHub release with tag `v${{ inputs.version }}` and auto-generated notes
2. Trigger `pypi-release.yml` to publish all packages to PyPI
3. Trigger `version-bump-prs.yml` to create downstream version bump PRs
EOF
gh pr create \
--title "Release v${{ inputs.version }}" \
--body-file pr_body.txt \
--base main \
--head "${{ env.BRANCH_NAME }}" \
--label "integration-test" \
--label "behavior-test" \
--label "test-examples"
rm pr_body.txt
echo "✅ Pull request created successfully!"
# Get PR URL and display it
PR_URL=$(gh pr view "${{ env.BRANCH_NAME }}" --json url --jq '.url')
echo "🔗 PR URL: $PR_URL"
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Summary
run: |
echo "## ✅ Release Preparation Complete!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Version**: ${{ inputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Branch**: ${{ env.BRANCH_NAME }}" >> $GITHUB_STEP_SUMMARY
echo "- **PR URL**: ${{ env.PR_URL }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "1. Review the PR and address any deprecation deadlines" >> $GITHUB_STEP_SUMMARY
echo "2. Wait for integration, behavior, and example tests to pass" >> $GITHUB_STEP_SUMMARY
echo "3. Merge the PR — a GitHub release and PyPI publish will happen automatically" >> $GITHUB_STEP_SUMMARY