mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
# Publishes the OpenHands PyPi package
|
|
name: Publish PyPi Package
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
reason:
|
|
description: "What are you publishing?"
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- app server
|
|
- cli
|
|
default: app server
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2204
|
|
# Run when manually dispatched for "app server" OR for tag pushes that don't contain '-cli'
|
|
if: |
|
|
(github.event_name == 'workflow_dispatch' && github.event.inputs.reason == 'app server')
|
|
|| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-cli'))
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: useblacksmith/setup-python@v6
|
|
with:
|
|
python-version: 3.12
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1.4.1
|
|
with:
|
|
virtualenvs-in-project: true
|
|
virtualenvs-path: ~/.virtualenvs
|
|
- name: Install Poetry Dependencies
|
|
run: poetry install --no-interaction --no-root
|
|
- name: Build poetry project
|
|
run: ./build.sh
|
|
- name: publish
|
|
run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
|
|
|
|
release-cli:
|
|
name: Publish CLI to PyPI
|
|
runs-on: ubuntu-latest
|
|
# Run when manually dispatched for "cli" OR for tag pushes that contain '-cli'
|
|
if: |
|
|
(github.event_name == 'workflow_dispatch' && github.event.inputs.reason == 'cli')
|
|
|| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-cli'))
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.12
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v3
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Build CLI package
|
|
working-directory: openhands-cli
|
|
run: |
|
|
# Clean dist directory to avoid conflicts with binary builds
|
|
rm -rf dist/
|
|
uv build
|
|
|
|
- name: Publish CLI to PyPI
|
|
working-directory: openhands-cli
|
|
run: |
|
|
uv publish --token ${{ secrets.PYPI_TOKEN_OPENHANDS }}
|