From c9d878256639466faf19b0e57b6af6c48e3d1719 Mon Sep 17 00:00:00 2001 From: Rohit Malhotra Date: Fri, 10 Oct 2025 11:25:19 -0400 Subject: [PATCH] V1(CLI): Release (#11317) --- ...li-build-binary-and-optionally-release.yml | 5 +- .github/workflows/cli-build-test.yml | 107 ------------------ .github/workflows/pypi-release.yml | 23 ++-- openhands-cli/pyproject.toml | 2 +- 4 files changed, 20 insertions(+), 117 deletions(-) delete mode 100644 .github/workflows/cli-build-test.yml diff --git a/.github/workflows/cli-build-binary-and-optionally-release.yml b/.github/workflows/cli-build-binary-and-optionally-release.yml index bf8c0e854a..a3a236fa44 100644 --- a/.github/workflows/cli-build-binary-and-optionally-release.yml +++ b/.github/workflows/cli-build-binary-and-optionally-release.yml @@ -12,6 +12,9 @@ on: paths: - "openhands-cli/**" +permissions: + contents: write # needed to create releases or upload assets + # Cancel previous runs if a new commit is pushed concurrency: group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }} @@ -101,4 +104,4 @@ jobs: draft: true prerelease: false env: - GITHUB_TOKEN: ${{ secrets.CLI_RELEASE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cli-build-test.yml b/.github/workflows/cli-build-test.yml deleted file mode 100644 index 0fddcbfe0a..0000000000 --- a/.github/workflows/cli-build-test.yml +++ /dev/null @@ -1,107 +0,0 @@ -# Workflow that builds and tests the CLI binary executable -name: CLI - Build and Test Binary - -# Run on pushes to main branch and CLI tags, and on pull requests when CLI files change -on: - push: - branches: - - main - tags: - - "*-cli" - pull_request: - paths: - - "openhands-cli/**" - -permissions: - contents: write # needed to create releases or upload assets - -# Cancel previous runs if a new commit is pushed -concurrency: - group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }} - cancel-in-progress: true - -jobs: - build-and-test-binary: - name: Build and test binary executable - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - 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: Install dependencies - working-directory: openhands-cli - run: | - uv sync - - - name: Build binary executable - working-directory: openhands-cli - run: | - ./build.sh --install-pyinstaller | tee output.log - echo "Full output:" - cat output.log - - if grep -q "❌" output.log; then - echo "❌ Found failure marker in output" - exit 1 - fi - - echo "✅ Build & test finished without ❌ markers" - - - name: Upload binary artifact (for releases only) - if: startsWith(github.ref, 'refs/tags/') - uses: actions/upload-artifact@v4 - with: - name: openhands-cli-${{ matrix.os }} - path: openhands-cli/dist/openhands* - retention-days: 30 - - create-github-release: - name: Create GitHub Release - runs-on: ubuntu-latest - needs: build-and-test-binary - if: startsWith(github.ref, 'refs/tags/') - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - - - name: Prepare release assets - run: | - mkdir -p release-assets - # Rename binaries to include OS in filename - if [ -f artifacts/openhands-cli-ubuntu-latest/openhands ]; then - cp artifacts/openhands-cli-ubuntu-latest/openhands release-assets/openhands-linux - fi - if [ -f artifacts/openhands-cli-macos-latest/openhands ]; then - cp artifacts/openhands-cli-macos-latest/openhands release-assets/openhands-macos - fi - ls -la release-assets/ - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - files: release-assets/* - draft: true - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 4713f6ea22..89a64aa58a 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -1,14 +1,17 @@ # Publishes the OpenHands PyPi package name: Publish PyPi Package - on: workflow_dispatch: inputs: reason: - description: 'Reason for manual trigger' + description: "What are you publishing?" required: true - default: '' + type: choice + options: + - app server + - cli + default: app server push: tags: - "*" @@ -16,8 +19,10 @@ on: jobs: release: runs-on: blacksmith-4vcpu-ubuntu-2204 - # Only run for tags that don't contain '-cli' - if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-cli') + # 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 @@ -38,8 +43,10 @@ jobs: release-cli: name: Publish CLI to PyPI runs-on: ubuntu-latest - # Only run for tags that contain '-cli' - if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-cli') + # 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 @@ -64,4 +71,4 @@ jobs: - name: Publish CLI to PyPI working-directory: openhands-cli run: | - uv publish --token ${{ secrets.PYPI_TOKEN }} + uv publish --token ${{ secrets.PYPI_TOKEN_OPENHANDS }} diff --git a/openhands-cli/pyproject.toml b/openhands-cli/pyproject.toml index 9c66ef9521..2bcf3056cd 100644 --- a/openhands-cli/pyproject.toml +++ b/openhands-cli/pyproject.toml @@ -4,7 +4,7 @@ requires = [ "hatchling>=1.25" ] [project] name = "openhands" -version = "0.1.0" +version = "1.0.0" description = "OpenHands CLI - Terminal User Interface for OpenHands AI Agent" readme = "README.md" license = { text = "MIT" }