publish-python-sdk.yml 2.2 KB

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