Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
name: Publish PyPI
on:
workflow_dispatch:
inputs:
package:
description: Package to publish
required: true
default: all
type: choice
options:
- all
- agentex-client
- agentex-sdk

release:
types: [published]
Expand Down Expand Up @@ -33,3 +43,5 @@ jobs:
# Back-compat fallback — used by bin/publish-pypi when the
# dedicated tokens above are unset.
PYPI_TOKEN: ${{ secrets.AGENTEX_PYPI_TOKEN || secrets.PYPI_TOKEN }}
# Manual dispatches can override tag-derived package selection.
PYPI_PACKAGE: ${{ inputs.package }}
50 changes: 45 additions & 5 deletions bin/publish-pypi
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
#!/usr/bin/env bash

# Publish slim (root) before heavy (adk/): heavy pins slim, so a slim-first
# failure aborts before shipping a heavy that needs an unreleased client.
# Publish only the package requested by the component tag. Manual dispatches can
# set PYPI_PACKAGE=all to publish both packages; in that case publish slim
# before heavy because the heavy package depends on the slim package.

set -eux

rm -rf dist
# --wheel: the heavy's cross-dir force-include can't build via sdist.
uv build --all-packages --wheel
Comment thread
jromualdez-scale marked this conversation as resolved.

# --check-url makes the per-component-tag double-trigger idempotent.
uv publish --check-url https://pypi.org/simple/ --token="${AGENTEX_CLIENT_PYPI_TOKEN:-$PYPI_TOKEN}" dist/agentex_client-*.whl
uv publish --check-url https://pypi.org/simple/ --token="${AGENTEX_PYPI_TOKEN:-$PYPI_TOKEN}" dist/agentex_sdk-*.whl
publish_client() {
uv publish --check-url https://pypi.org/simple/ --token="${AGENTEX_CLIENT_PYPI_TOKEN:-${PYPI_TOKEN:-}}" dist/agentex_client-*.whl
}

publish_sdk() {
uv publish --check-url https://pypi.org/simple/ --token="${AGENTEX_PYPI_TOKEN:-${PYPI_TOKEN:-}}" dist/agentex_sdk-*.whl
}

package="${PYPI_PACKAGE:-}"

if [ -z "$package" ]; then
tag_name="${GITHUB_REF_NAME:-}"
if [ -z "$tag_name" ] && [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then
tag_name="${GITHUB_REF#refs/tags/}"
fi

case "$tag_name" in
agentex-client-v*) package="agentex-client" ;;
agentex-sdk-v*) package="agentex-sdk" ;;
*)
echo "Unable to infer package from tag '$tag_name'. Set PYPI_PACKAGE to one of: all, agentex-client, agentex-sdk." >&2
exit 1
;;
esac
fi

case "$package" in
all)
publish_client
publish_sdk
;;
agentex-client)
publish_client
;;
agentex-sdk)
publish_sdk
;;
*)
echo "Unknown PYPI_PACKAGE '$package'. Expected one of: all, agentex-client, agentex-sdk." >&2
exit 1
;;
esac
Loading