File tree Expand file tree Collapse file tree 4 files changed +70
-4
lines changed
Expand file tree Collapse file tree 4 files changed +70
-4
lines changed Original file line number Diff line number Diff line change 1+ name : Python SDK Publish
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - " sdk-python/**"
9+ - " .github/workflows/python-sdk-publish.yml"
10+ workflow_dispatch :
11+
12+ jobs :
13+ publish-python-sdk :
14+ runs-on : ubuntu-latest
15+ environment : pypi
16+ permissions :
17+ contents : read
18+ id-token : write
19+
20+ steps :
21+ - name : Checkout code
22+ uses : actions/checkout@v4
23+
24+ - name : Setup Python
25+ uses : actions/setup-python@v5
26+ with :
27+ python-version : " 3.12"
28+
29+ - name : Install build dependency
30+ run : |
31+ python -m pip install --upgrade pip
32+ pip install build
33+
34+ - name : Build package
35+ run : make build-python-sdk
36+
37+ - name : Read package version
38+ id : package
39+ working-directory : sdk-python
40+ run : |
41+ version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
42+ echo "version=$version" >> "$GITHUB_OUTPUT"
43+
44+ - name : Check whether version already exists on PyPI
45+ id : pypi
46+ env :
47+ PACKAGE_NAME : agentcube-sdk
48+ PACKAGE_VERSION : ${{ steps.package.outputs.version }}
49+ run : |
50+ status="$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/${PACKAGE_NAME}/${PACKAGE_VERSION}/json")"
51+ if [ "$status" = "200" ]; then
52+ echo "exists=true" >> "$GITHUB_OUTPUT"
53+ echo "Version ${PACKAGE_VERSION} already exists on PyPI, skipping publish."
54+ else
55+ echo "exists=false" >> "$GITHUB_OUTPUT"
56+ echo "Version ${PACKAGE_VERSION} is not published yet."
57+ fi
58+
59+ - name : Publish package to PyPI
60+ if : steps.pypi.outputs.exists != 'true'
61+ uses : pypa/gh-action-pypi-publish@release/v1
62+ with :
63+ packages-dir : sdk-python/dist/
Original file line number Diff line number Diff line change @@ -319,6 +319,8 @@ e2e-clean:
319319.PHONY : build-python-sdk
320320build-python-sdk : # # Build Python SDK
321321 @echo " Building Python SDK..."
322- cp LICENSE sdk-python/LICENSE
323- cd sdk-python && python3 -m build; cd ..; rm -f sdk-python/LICENSE
324- @echo " Build complete. Artifacts are in sdk-python/dist/"
322+ @tmp_file=" $( PROJECT_DIR) /sdk-python/LICENSE" ; \
323+ trap ' rm -f "$$tmp_file"' EXIT; \
324+ cp LICENSE " $$ tmp_file" ; \
325+ cd sdk-python && python3 -m build
326+ @echo " Build complete. Artifacts are in sdk-python/dist/"
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ include LICENSE
22include README.md
33include requirements.txt
44recursive-include examples *
5+ global-exclude __pycache__ *.py[cod]
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ name = "agentcube-sdk"
77version = " 0.1.0"
88description = " Python SDK for AgentCube Code Interpreter"
99readme = " README.md"
10- license = { text = " Apache-2.0" }
10+ license = " Apache-2.0"
1111requires-python = " >=3.10"
1212
1313dependencies = [
You can’t perform that action at this time.
0 commit comments