Skip to content

Prepare Release

Prepare Release #49

---
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
env:
INPUTS_VERSION: ${{ inputs.version }}
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@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # 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
env:
INPUTS_VERSION: ${{ inputs.version }}
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
env:
INPUTS_VERSION: ${{ inputs.version }}
run: |
echo "🔧 Setting version to $INPUTS_VERSION"
make set-package-version version="$INPUTS_VERSION"
- name: Update sdk_ref default in run-eval workflow
env:
INPUTS_VERSION: ${{ inputs.version }}
run: python3 .github/scripts/update_sdk_ref_default.py "$INPUTS_VERSION"
- name: Commit version changes
env:
INPUTS_VERSION: ${{ inputs.version }}
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 "$BRANCH_NAME"
echo "✅ Branch pushed: $BRANCH_NAME"
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.OPENHANDS_BOT_GITHUB_PAT_PUBLIC }}
INPUTS_VERSION: ${{ inputs.version }}
run: |
python3 << 'PY'
import os
from pathlib import Path
version = os.environ["INPUTS_VERSION"]
Path("pr_body.txt").write_text(
f"""## Release v{version}
This PR prepares the release for version **{version}**.
### Release Checklist
- [x] Version set to {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
- [ ] Confirm any `release-note-required` PRs are accurately called out in the final release notes
### What happens on merge
When this PR is merged, the `create-release.yml` workflow will automatically:
1. Create a GitHub release with tag `v{version}` and auto-generated notes, plus an explicit preamble for merged `release-note-required` PRs
2. Trigger `pypi-release.yml` to publish all packages to PyPI
3. Trigger `version-bump-prs.yml` to create downstream version bump PRs
"""
)
PY
gh pr create \
--title "Release v$INPUTS_VERSION" \
--body-file pr_body.txt \
--base main \
--head "$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 "$BRANCH_NAME" --json url --jq '.url')
echo "🔗 PR URL: $PR_URL"
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Summary
env:
INPUTS_VERSION: ${{ inputs.version }}
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