Skip to content

Commit 551a697

Browse files
authored
Merge pull request #6 from ninan-nn/ci/publish_work_flow
ci: add workflow to publish python sdk
2 parents ad22490 + d7dcde9 commit 551a697

File tree

3 files changed

+89
-4
lines changed

3 files changed

+89
-4
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright 2025 Alibaba Group Holding Ltd.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Publish Python SDKs
16+
17+
on:
18+
push:
19+
tags:
20+
- 'python/sandbox/v*'
21+
- 'python/code-interpreter/v*'
22+
23+
jobs:
24+
publish-sandbox:
25+
if: startsWith(github.ref, 'refs/tags/python/sandbox/v')
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: '3.10'
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v5
38+
with:
39+
version: "latest"
40+
41+
- name: Generate API
42+
working-directory: sdks/sandbox/python
43+
run: |
44+
uv run python scripts/generate_api.py
45+
46+
- name: Build package
47+
working-directory: sdks/sandbox/python
48+
run: |
49+
uv build
50+
51+
- name: Publish to PyPI
52+
working-directory: sdks/sandbox/python
53+
env:
54+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
55+
run: |
56+
uv publish
57+
58+
publish-code-interpreter:
59+
if: startsWith(github.ref, 'refs/tags/python/code-interpreter/v')
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.10'
69+
70+
- name: Install uv
71+
uses: astral-sh/setup-uv@v5
72+
with:
73+
version: "latest"
74+
75+
- name: Build package
76+
working-directory: sdks/code-interpreter/python
77+
run: |
78+
uv build
79+
80+
- name: Publish to PyPI
81+
working-directory: sdks/code-interpreter/python
82+
env:
83+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
84+
run: |
85+
uv publish

sdks/code-interpreter/python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ source = "vcs"
5858
[tool.hatch.version.raw-options]
5959
# This package is in a subdirectory; explicitly point setuptools-scm at the git root.
6060
root = "../../.."
61-
tag_regex = "^python-code-interpreter-v(?P<version>\\d+\\.\\d+\\.\\d+(?:[\\.\\w\\+\\-]*)?)$"
62-
git_describe_command = 'git describe --dirty --tags --long --match "python-code-interpreter-v*"'
61+
tag_regex = "^python/code-interpreter/v(?P<version>\\d+\\.\\d+\\.\\d+(?:[\\.\\w\\+\\-]*)?)$"
62+
git_describe_command = 'git describe --dirty --tags --long --match "python/code-interpreter/v*"'
6363
fallback_version = "0.1.0"
6464

6565
[tool.hatch.build]

sdks/sandbox/python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ source = "vcs"
6060
[tool.hatch.version.raw-options]
6161
# This package is in a subdirectory; explicitly point setuptools-scm at the git root.
6262
root = "../../.."
63-
tag_regex = "^python-sandbox-v(?P<version>\\d+\\.\\d+\\.\\d+(?:[\\.\\w\\+\\-]*)?)$"
64-
git_describe_command = 'git describe --dirty --tags --long --match "python-sandbox-v*"'
63+
tag_regex = "^python/sandbox/v(?P<version>\\d+\\.\\d+\\.\\d+(?:[\\.\\w\\+\\-]*)?)$"
64+
git_describe_command = 'git describe --dirty --tags --long --match "python/sandbox/v*"'
6565
fallback_version = "0.1.0"
6666

6767
[tool.hatch.build]

0 commit comments

Comments
 (0)