-
Notifications
You must be signed in to change notification settings - Fork 213
70 lines (61 loc) · 2.59 KB
/
pypi-release.yml
File metadata and controls
70 lines (61 loc) · 2.59 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
---
name: Publish all OpenHands packages (uv)
on:
# Run manually
workflow_dispatch:
# Run automatically when a release is published
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Extract version from release tag
id: extract_version
run: |
# Get version from release tag (e.g., v1.2.3 -> 1.2.3)
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
# For manual dispatch, extract from pyproject.toml
VERSION=$(grep -m1 '^version = ' openhands-sdk/pyproject.toml | cut -d'"' -f2)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "📦 Version: $VERSION"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: latest
python-version: '3.13'
- name: Build and publish all packages
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN_OPENHANDS }}
run: |
set -euo pipefail
if [ -z "${UV_PUBLISH_TOKEN:-}" ]; then
echo "❌ Missing secret PYPI_TOKEN_OPENHANDS"
exit 1
fi
PACKAGES=(
openhands-sdk
openhands-tools
openhands-workspace
openhands-agent-server
)
echo "🚀 Building and publishing all packages..."
for PKG in "${PACKAGES[@]}"; do
echo "===== $PKG ====="
uv build --package "$PKG"
done
# Use --check-url to skip files that already exist on PyPI
# This allows re-running the workflow after partial failures
uv publish --token "$UV_PUBLISH_TOKEN" --check-url https://pypi.org/simple/
echo "✅ All packages built and published successfully!"
echo ""
echo "📋 Note: Version bump PRs will be created by the 'Create Version Bump PRs' workflow"
echo " which triggers automatically after this workflow completes."