From 28f0f93eceb2ea0960f06f152edc8263749ba4d3 Mon Sep 17 00:00:00 2001 From: RadeenXALNW Date: Wed, 27 Aug 2025 10:11:26 +0000 Subject: [PATCH 1/3] added version command to see package version --- release.sh | 72 ++++++---------------------------------- runagent/cli/commands.py | 20 +++++++++++ runagent/cli/main.py | 4 ++- 3 files changed, 34 insertions(+), 62 deletions(-) diff --git a/release.sh b/release.sh index 3151384..13e660d 100644 --- a/release.sh +++ b/release.sh @@ -105,6 +105,7 @@ update_python_version() { local version=$1 local pyproject_file="pyproject.toml" local version_file="runagent/__version__.py" + local init_file="runagent/__init__.py" local success=false # Update pyproject.toml @@ -132,6 +133,15 @@ update_python_version() { echo "__version__ = \"$version\"" > "$version_file" fi + # Also update __init__.py version + if [[ -f "$init_file" ]]; then + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "s/__version__ = \".*\"/__version__ = \"$version\"/" "$init_file" + else + sed -i "s/__version__ = \".*\"/__version__ = \"$version\"/" "$init_file" + fi + fi + if verify_version_update "$version_file" "$version" "__version__ = \"$version\""; then success=true fi @@ -222,57 +232,10 @@ EOF } generate_changelog() { - # local version=$1 - # local tag_name="v$version" - - # echo "📝 Generating changelog with git-cliff..." - - # # Find the previous tag to determine range - # local last_tag - # last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") - - # if [[ -n "$last_tag" ]]; then - # echo "📍 Generating changelog for range: $last_tag → $tag_name" - - # # Generate changelog for the current version using --latest if we're at the latest - # # Or specify the tag explicitly for historical generation - # if [[ -f "cliff.toml" ]]; then - # First try to generate for the specific tag - # git-cliff --tag "$tag_name" --latest --strip header --strip footer > "CHANGELOG_NEW.md" 2>/dev/null || { - # echo "⚠️ git-cliff --latest failed, trying full tag generation" - # git-cliff --tag "$tag_name" --strip header --strip footer > "CHANGELOG_NEW.md" 2>/dev/null || { - # echo "⚠️ git-cliff failed, creating basic changelog" - # create_basic_changelog "$version" "$last_tag" - # return - # } - # } - # else - # git-cliff --tag "$tag_name" --latest --strip header --strip footer > "CHANGELOG_NEW.md" 2>/dev/null || { - # echo "⚠️ git-cliff failed, creating basic changelog" - # create_basic_changelog "$version" "$last_tag" - # return - # } - # fi - # else - # echo "📍 No previous tags found - generating changelog for initial release" - # create_initial_changelog "$version" - # return - # fi - - # Check if we got meaningful output - # if [[ ! -s "CHANGELOG_NEW.md" ]] || [[ $(wc -l < "CHANGELOG_NEW.md") -lt 2 ]]; then - # echo "⚠️ git-cliff produced minimal output, creating basic changelog" - # create_basic_changelog "$version" "$last_tag" - # return - # fi git-cliff --output CHANGELOG.md --latest - # Update main CHANGELOG.md - # update_main_changelog "$version" - echo "✅ Changelog generated successfully" } - show_update_summary() { echo "" echo "📋 Update Summary:" @@ -317,7 +280,6 @@ check_prerequisites() { echo "❌ Error: Not in a git repository or git is not working" exit 1 fi - } handle_existing_tag() { @@ -372,7 +334,6 @@ check_git_cliff check_prerequisites - # Update all package files update_python_version "$VERSION" update_javascript_version "$VERSION" @@ -389,16 +350,9 @@ fi if [[ "$any_success" == "false" ]]; then echo "❌ No version updates succeeded. Aborting release." - # # Restore backup - # if [[ -f "CHANGELOG.md.bak" ]]; then - # mv "CHANGELOG.md.bak" "CHANGELOG.md" - # fi exit 1 fi -# Generate changelog -# generate_changelog "$VERSION" - # Show git changes if ! git diff --name-only --quiet 2>/dev/null; then echo "Changes detected:" @@ -413,11 +367,9 @@ echo "" if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Release cancelled." git checkout -- . 2>/dev/null || true - exit 0 fi - # Handle existing tag if handle_existing_tag "$VERSION"; then echo "✅ Tag v$VERSION updated successfully!" @@ -425,7 +377,6 @@ if handle_existing_tag "$VERSION"; then exit 0 fi - # Stage and commit changes git add . @@ -434,7 +385,7 @@ if git diff --staged --quiet; then exit 1 fi -# # Create new tag +# Create new tag git tag -a "v$VERSION" -m "Release v$VERSION RunAgent Universal Release v$VERSION" @@ -443,7 +394,6 @@ echo "✅ Tag v$VERSION created and pushed successfully!" generate_changelog - git commit -m "chore: bump version to v$VERSION - Updated all SDK versions to $VERSION diff --git a/runagent/cli/commands.py b/runagent/cli/commands.py index cc5b0ff..2379482 100644 --- a/runagent/cli/commands.py +++ b/runagent/cli/commands.py @@ -27,6 +27,26 @@ console = Console() +def print_version(ctx, param, value): + """Custom version callback with colored output""" + if not value or ctx.resilient_parsing: + return + try: + from runagent.__version__ import __version__ + console.print(f"[bold cyan]runagent {__version__}[/bold cyan]") + except ImportError: + console.print("[red]runagent version unknown[/red]") + ctx.exit() + + +@click.command() +def version(): + """Show version information""" + try: + from runagent.__version__ import __version__ + console.print(f"[bold cyan]runagent {__version__}[/bold cyan]") + except ImportError: + console.print("[red]runagent version unknown[/red]") @click.command() @click.option("--api-key", required=True, help="Your API key") diff --git a/runagent/cli/main.py b/runagent/cli/main.py index 7efe548..fbbce6f 100644 --- a/runagent/cli/main.py +++ b/runagent/cli/main.py @@ -1,14 +1,15 @@ - import click from . import commands @click.group() +@click.option('--version', is_flag=True, expose_value=False, is_eager=True, callback=commands.print_version, help='Show version information') def runagent(): """RunAgent CLI - Deploy and manage AI agents easily""" pass +runagent.add_command(commands.version) runagent.add_command(commands.setup) runagent.add_command(commands.teardown) runagent.add_command(commands.init) @@ -22,5 +23,6 @@ def runagent(): runagent.add_command(commands.delete) runagent.add_command(commands.db) runagent.add_command(commands.local_sync) + if __name__ == "__main__": runagent() \ No newline at end of file From c39d881c9a395a047db2fb394846fe8c603f6606 Mon Sep 17 00:00:00 2001 From: sawradip Date: Fri, 29 Aug 2025 18:57:38 +0600 Subject: [PATCH 2/3] chore: bump version to v0.1.20 - Updated all SDK versions to 0.1.20 - Generated changelog with git-cliff --- .github/workflows/create-release.yml | 106 ++++++++++++++++++++++++++- pyproject.toml | 6 +- release.sh | 0 runagent-go/runagent/version.go | 2 +- runagent-rust/runagent/Cargo.toml | 2 +- runagent-ts/package.json | 2 +- runagent/__init__.py | 2 +- runagent/__version__.py | 2 +- 8 files changed, 110 insertions(+), 12 deletions(-) mode change 100644 => 100755 release.sh diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 030d30a..7d06672 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -1,13 +1,11 @@ # .github/workflows/create-release.yml -name: Create GitHub Release - +name: Create GitHub Release and Publish to PyPI on: push: branches: [main] # Trigger on ANY push to main (including PR merges) pull_request: types: [closed] # Also trigger when PRs are merged branches: [main] - jobs: detect-and-release: runs-on: ubuntu-latest @@ -82,7 +80,101 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + # NEW: Set up Python for PyPI publishing + - name: Set up Python + if: steps.check-release.outputs.should_release == 'true' + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + # NEW: Install build dependencies + - name: Install build dependencies + if: steps.check-release.outputs.should_release == 'true' + run: | + python -m pip install --upgrade pip + python -m pip install build twine + + # NEW: Verify version matches tag + - name: Verify package version matches tag + if: steps.check-release.outputs.should_release == 'true' + run: | + TAG_VERSION="${{ steps.find-tags.outputs.version }}" + + # Check if setup.py exists + if [ -f "setup.py" ]; then + PACKAGE_VERSION=$(python setup.py --version) + # Check if pyproject.toml exists + elif [ -f "pyproject.toml" ]; then + # Extract version from pyproject.toml + PACKAGE_VERSION=$(python -c " + import tomllib + with open('pyproject.toml', 'rb') as f: + data = tomllib.load(f) + print(data['project']['version']) + ") + else + echo "❌ Neither setup.py nor pyproject.toml found!" + exit 1 + fi + + echo "Tag version: $TAG_VERSION" + echo "Package version: $PACKAGE_VERSION" + + if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then + echo "❌ Version mismatch! Tag: $TAG_VERSION, Package: $PACKAGE_VERSION" + exit 1 + else + echo "✅ Version match confirmed: $TAG_VERSION" + fi + + # NEW: Build Python package + - name: Build package + if: steps.check-release.outputs.should_release == 'true' + run: python -m build + + # NEW: Check if package already exists on PyPI + - name: Check if package exists on PyPI + if: steps.check-release.outputs.should_release == 'true' + id: check-pypi + run: | + VERSION="${{ steps.find-tags.outputs.version }}" + + # Get package name from setup.py or pyproject.toml + if [ -f "pyproject.toml" ]; then + PACKAGE_NAME=$(python -c " + import tomllib + with open('pyproject.toml', 'rb') as f: + data = tomllib.load(f) + print(data['project']['name']) + ") + elif [ -f "setup.py" ]; then + PACKAGE_NAME=$(python setup.py --name) + else + echo "❌ Cannot determine package name" + exit 1 + fi + + echo "Checking if $PACKAGE_NAME version $VERSION exists on PyPI..." + + # Check if this version already exists on PyPI + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/$PACKAGE_NAME/$VERSION/json/") + + if [ "$HTTP_CODE" = "200" ]; then + echo "⚠️ Package $PACKAGE_NAME v$VERSION already exists on PyPI, skipping upload" + echo "should_publish_pypi=false" >> $GITHUB_OUTPUT + else + echo "✅ Package $PACKAGE_NAME v$VERSION not found on PyPI, proceeding with upload" + echo "should_publish_pypi=true" >> $GITHUB_OUTPUT + fi + + # NEW: Publish to PyPI using API token + - name: Publish package to PyPI + if: steps.check-release.outputs.should_release == 'true' && steps.check-pypi.outputs.should_publish_pypi == 'true' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + print-hash: true + - name: Create main GitHub Release if: steps.check-release.outputs.should_release == 'true' uses: softprops/action-gh-release@v1 @@ -100,6 +192,12 @@ jobs: This release synchronizes all RunAgent SDKs (Python, JavaScript, Rust, Go) to version ${{ steps.find-tags.outputs.version }}. + ## 📦 Installation + + ```bash + pip install runagent==${{ steps.find-tags.outputs.version }} + ``` + draft: false prerelease: false generate_release_notes: true # Let GitHub add commit-based notes diff --git a/pyproject.toml b/pyproject.toml index d54de53..d364b7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "runagent" -version = "0.1.19" +version = "0.1.20" description = "A command-line tool and SDK for deploying, managing, and interacting with AI agents" readme = "README.md" requires-python = ">=3.9" @@ -103,7 +103,7 @@ line_length = 88 skip = ["docs"] [tool.mypy] -python_version = "0.1.19" +python_version = "0.1.20" warn_return_any = true warn_unused_configs = true disallow_untyped_defs = true @@ -159,7 +159,7 @@ fail_under = 80 [tool.ruff] line-length = 88 -target-version = "0.1.19" +target-version = "0.1.20" select = [ "E", # pycodestyle errors "W", # pycodestyle warnings diff --git a/release.sh b/release.sh old mode 100644 new mode 100755 diff --git a/runagent-go/runagent/version.go b/runagent-go/runagent/version.go index 11d8ecc..4b4fa5a 100644 --- a/runagent-go/runagent/version.go +++ b/runagent-go/runagent/version.go @@ -1,4 +1,4 @@ package runagent // Version represents the current version of the RunAgent Go SDK -const Version = "0.1.19" +const Version = "0.1.20" diff --git a/runagent-rust/runagent/Cargo.toml b/runagent-rust/runagent/Cargo.toml index ed9059f..68e4c79 100644 --- a/runagent-rust/runagent/Cargo.toml +++ b/runagent-rust/runagent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runagent" -version = "0.1.19" +version = "0.1.20" edition = "2021" description = "RunAgent SDK for Rust - Deploy and manage AI agents easily" license = "MIT" diff --git a/runagent-ts/package.json b/runagent-ts/package.json index 637870c..3531e0d 100644 --- a/runagent-ts/package.json +++ b/runagent-ts/package.json @@ -1,6 +1,6 @@ { "name": "runagent", - "version": "0.1.19", + "version": "0.1.20", "type": "module", "files": [ "dist" diff --git a/runagent/__init__.py b/runagent/__init__.py index 79b2a76..026367e 100644 --- a/runagent/__init__.py +++ b/runagent/__init__.py @@ -5,7 +5,7 @@ built with frameworks like LangGraph, LangChain, and LlamaIndex. """ -__version__ = "0.1.0" +__version__ = "0.1.20" from .client import RunAgentClient diff --git a/runagent/__version__.py b/runagent/__version__.py index d38c350..8754a47 100644 --- a/runagent/__version__.py +++ b/runagent/__version__.py @@ -1 +1 @@ -__version__ = "0.1.19" +__version__ = "0.1.20" From 8d818c86763be4b04d19e946b64a6d6caf73cf8f Mon Sep 17 00:00:00 2001 From: sawradip Date: Fri, 29 Aug 2025 18:58:13 +0600 Subject: [PATCH 3/3] bumped version to 0.1.20 --- CHANGELOG.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06cdae6..eecc66f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,14 @@ # Changelog All notable changes to this project's latest version. -## [0.1.18] - 2025-07-29 +## [0.1.20] - 2025-08-27 ### Bug Fixes -- Fixed relase yml - -### Features - -- Realease action workflow fixed +- Workflow cliff install fixed ([#46](https://github.com/your-org/your-repo/issues/46)) ### Miscellaneous Tasks -- Bump version to v0.1.18 +- Bump version to v0.1.19