FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
opencode/.github/publish-python-sdk.yml at dev · pvi-github/opencode · GitHub
pvi-github
/
opencode
Public
forked from
anomalyco/opencode
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
opencode
/
.github
/
publish-python-sdk.yml
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (61 loc) · 2.16 KB
Breadcrumbs
opencode
/
.github
/
publish-python-sdk.yml
Copy path
File metadata and controls
71 lines (61 loc) · 2.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
#
This file is intentionally in the wrong dir, will move and add later....
#
#
name: publish-python-sdk
#
on:
#
release:
#
types: [published]
#
workflow_dispatch:
#
jobs:
#
publish:
#
runs-on: ubuntu-latest
#
permissions:
#
contents: read
#
steps:
#
- name: Checkout repository
#
uses: actions/checkout@v4
#
- name: Setup Bun
#
uses: oven-sh/setup-bun@v1
#
with:
#
bun-version: 1.2.21
#
- name: Install dependencies (JS/Bun)
#
run: bun install
#
- name: Install uv
#
shell: bash
#
run: curl -LsSf https://astral.sh/uv/install.sh | sh
#
- name: Generate Python SDK from OpenAPI (CLI)
#
shell: bash
#
run: |
#
~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/generate.py --source cli
#
- name: Sync Python dependencies
#
shell: bash
#
run: |
#
~/.local/bin/uv sync --dev --project packages/sdk/python
#
- name: Set version from release tag
#
shell: bash
#
run: |
#
TAG="${GITHUB_REF_NAME:-}"
#
if [ -z "$TAG" ]; then
#
TAG="$(git describe --tags --abbrev=0 || echo 0.0.0)"
#
fi
#
echo "Using version: $TAG"
#
VERSION="$TAG" ~/.local/bin/uv run --project packages/sdk/python python - <<'PY'
#
import os, re, pathlib
#
root = pathlib.Path('packages/sdk/python')
#
pt = (root / 'pyproject.toml').read_text()
#
version = os.environ.get('VERSION','0.0.0').lstrip('v')
#
pt = re.sub(r'(?m)^(version\s*=\s*")[^"]+("\s*)$', f"\\1{version}\\2", pt)
#
(root / 'pyproject.toml').write_text(pt)
#
# Also update generator config override for consistency
#
cfgp = root / 'openapi-python-client.yaml'
#
if cfgp.exists():
#
cfg = cfgp.read_text()
#
cfg = re.sub(r'(?m)^(package_version_override:\s*)\S+$', f"\\1{version}", cfg)
#
cfgp.write_text(cfg)
#
PY
#
- name: Build and publish to PyPI
#
env:
#
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
#
shell: bash
#
run: |
#
~/.local/bin/uv run --project packages/sdk/python python packages/sdk/python/scripts/publish.py
Back
|
FazBrowse Home
|
New Git URL