-
Notifications
You must be signed in to change notification settings - Fork 213
132 lines (113 loc) · 5.6 KB
/
prepare-release.yml
File metadata and controls
132 lines (113 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
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.PAT_TOKEN }}
- 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.PAT_TOKEN }}
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`)
- [ ] Draft release created at https://github.com/OpenHands/software-agent-sdk/releases/new
- [ ] Select tag: `v${{ inputs.version }}`
- [ ] Select branch: `${{ env.BRANCH_NAME }}`
- [ ] Auto-generate release notes
- [ ] Publish release (PyPI will auto-publish)
- [ ] Evaluation on OpenHands Index
### Next Steps
1. Review the version changes
2. Address any deprecation deadlines
3. Ensure integration tests pass
4. Ensure behavior tests pass
5. Ensure example tests pass
6. Create and publish the release
Once the release is published on GitHub, the PyPI packages will be automatically published via the `pypi-release.yml` workflow.
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. Create and publish the release on GitHub" >> $GITHUB_STEP_SUMMARY
echo "4. PyPI will automatically publish when the release is created" >> $GITHUB_STEP_SUMMARY