|
| 1 | +# |
| 2 | +# This file is intentionally in the wrong dir, will move and add later.... |
| 3 | +# |
| 4 | + |
| 5 | +# name: publish-python-sdk |
| 6 | + |
| 7 | +# on: |
| 8 | +# release: |
| 9 | +# types: [published] |
| 10 | +# workflow_dispatch: |
| 11 | + |
| 12 | +# jobs: |
| 13 | +# publish: |
| 14 | +# runs-on: ubuntu-latest |
| 15 | +# permissions: |
| 16 | +# contents: read |
| 17 | +# steps: |
| 18 | +# - name: Checkout repository |
| 19 | +# uses: actions/checkout@v4 |
| 20 | + |
| 21 | +# - name: Setup Bun |
| 22 | +# uses: oven-sh/setup-bun@v1 |
| 23 | +# with: |
| 24 | +# bun-version: 1.2.21 |
| 25 | + |
| 26 | +# - name: Install dependencies (JS/Bun) |
| 27 | +# run: bun install |
| 28 | + |
| 29 | +# - name: Install uv |
| 30 | +# shell: bash |
| 31 | +# run: curl -LsSf https://astral.sh/uv/install.sh | sh |
| 32 | + |
| 33 | +# - name: Generate Python SDK from OpenAPI (CLI) |
| 34 | +# shell: bash |
| 35 | +# run: | |
| 36 | +# ~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/generate.py --source cli |
| 37 | + |
| 38 | +# - name: Sync Python dependencies |
| 39 | +# shell: bash |
| 40 | +# run: | |
| 41 | +# ~/.local/bin/uv sync --dev --project packages/sdk/python |
| 42 | + |
| 43 | +# - name: Set version from release tag |
| 44 | +# shell: bash |
| 45 | +# run: | |
| 46 | +# TAG="${GITHUB_REF_NAME:-}" |
| 47 | +# if [ -z "$TAG" ]; then |
| 48 | +# TAG="$(git describe --tags --abbrev=0 || echo 0.0.0)" |
| 49 | +# fi |
| 50 | +# echo "Using version: $TAG" |
| 51 | +# VERSION="$TAG" ~/.local/bin/uv run --project packages/sdk/python python - <<'PY' |
| 52 | +# import os, re, pathlib |
| 53 | +# root = pathlib.Path('packages/sdk/python') |
| 54 | +# pt = (root / 'pyproject.toml').read_text() |
| 55 | +# version = os.environ.get('VERSION','0.0.0').lstrip('v') |
| 56 | +# pt = re.sub(r'(?m)^(version\s*=\s*")[^"]+("\s*)$', f"\\1{version}\\2", pt) |
| 57 | +# (root / 'pyproject.toml').write_text(pt) |
| 58 | +# # Also update generator config override for consistency |
| 59 | +# cfgp = root / 'openapi-python-client.yaml' |
| 60 | +# if cfgp.exists(): |
| 61 | +# cfg = cfgp.read_text() |
| 62 | +# cfg = re.sub(r'(?m)^(package_version_override:\s*)\S+$', f"\\1{version}", cfg) |
| 63 | +# cfgp.write_text(cfg) |
| 64 | +# PY |
| 65 | + |
| 66 | +# - name: Build and publish to PyPI |
| 67 | +# env: |
| 68 | +# PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 69 | +# shell: bash |
| 70 | +# run: | |
| 71 | +# ~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/publish.py |
0 commit comments