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
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Python Release

# Publishes the arkruntime package to PyPI (pypi.org/project/arkruntime,
# maintained by the volcengine account). Tags are created exclusively by
# ark-hand after a sync PR lands on main, so a pushed v* tag is always a
# reviewed release snapshot whose tree matches the internal source tree.
#
# The workflow_dispatch input allows re-publishing (or first-publishing)
# an existing tag — e.g. when the PYPI_API_TOKEN secret was missing when
# the tag was originally pushed. The workflow definition runs from the
# ref the dispatch targets, while the build checks out the named tag.
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish (must already exist, e.g. v0.2.0)"
required: true
type: string

permissions:
contents: read

# Never cancel an in-flight publish; a second dispatch for the same tag
# should queue behind it instead of racing the upload.
concurrency:
group: python-release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
cancel-in-progress: false

jobs:
release:
name: Build and publish to PyPI
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Resolve release tag
id: tag
env:
DISPATCH_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || '' }}
run: |
tag="${DISPATCH_TAG:-${GITHUB_REF_NAME}}"
case "${tag}" in
v[0-9]*.[0-9]*.0) ;;
*)
echo "::error::${tag} is not a release tag (expected vMAJOR.MINOR.0)"
exit 1
;;
esac
echo "name=${tag}" >> "$GITHUB_OUTPUT"

- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ steps.tag.outputs.name }}

- name: Verify pyproject version matches tag
env:
RELEASE_TAG: ${{ steps.tag.outputs.name }}
run: |
version="${RELEASE_TAG#v}"
if ! grep -Eq "^version = \"${version}\"$" pyproject.toml; then
echo "::error::pyproject.toml version does not match tag ${RELEASE_TAG}"
grep -n '^version' pyproject.toml || true
exit 1
fi

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: python -m pip install --disable-pip-version-check --quiet uv

- name: Build sdist and wheel
run: uv build

- name: Check PyPI token
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ -z "${PYPI_API_TOKEN}" ]; then
echo "::error::secret PYPI_API_TOKEN is not configured on this repository"
exit 1
fi

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
attestations: false
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "arkruntime"
version = "0.1.0"
version = "0.2.0"
description = "Ark runtime SDK for Python"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
4 changes: 2 additions & 2 deletions src/arkruntime/types/images/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@


class Usage(BaseModel):
input_images: int
input_images: Optional[int] = None
"""
Number of reference images supplied by the client.
Number of reference images supplied by the client. May be absent in responses from older services.
"""
generated_images: int
"""
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading