11# Publish TypeScript (npm) and Python (PyPI) SDKs.
22#
33# Triggers:
4- # - workflow_dispatch: manual publish from the selected ref (typically main) .
5- # - workflow_run: after "Release tag check" succeeds (tag push → verify → then publish) .
4+ # - workflow_dispatch: choose SDKs via inputs (defaults: both). Ref is usually main.
5+ # - workflow_run: after "Release tag check" succeeds — publishes both SDKs .
66#
77# Required repo secrets: NPM_TOKEN, PYPI_API_TOKEN
8- name : Publish SDKs
8+ name : Publish
99
1010on :
1111 workflow_dispatch :
12+ inputs :
13+ publish_typescript :
14+ description : Publish TypeScript SDK to npm (@hyperterse/sandboxer)
15+ type : boolean
16+ default : true
17+ publish_python :
18+ description : Publish Python SDK to PyPI (hyperterse-sandboxer)
19+ type : boolean
20+ default : true
1221 workflow_run :
1322 workflows : ["Release tag check"]
1423 types :
1524 - completed
1625
1726jobs :
18- publish :
19- if : github.event_name == 'workflow_dispatch ' || github.event.workflow_run.conclusion == 'success'
27+ publish-typescript :
28+ if : github.event_name == 'workflow_run ' || ( github.event_name == 'workflow_dispatch' && inputs.publish_typescript)
2029 runs-on : ubuntu-latest
2130 permissions :
2231 contents : read
3544 with :
3645 bun-version : " latest"
3746
38- - uses : actions/setup-python@v5
39- with :
40- python-version : " 3.11"
41-
4247 - uses : actions/setup-node@v4
4348 with :
4449 registry-url : https://registry.npmjs.org
@@ -49,18 +54,45 @@ jobs:
4954 - name : Build TypeScript SDK
5055 run : bun run build:typescript
5156
52- - name : Build Python package
53- working-directory : sdks/python
54- run : |
55- python3 -m pip install --upgrade pip build twine
56- python3 -m build
57-
5857 - name : Publish to npm
5958 working-directory : sdks/typescript
6059 run : npm publish --access public
6160 env :
6261 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
6362
63+ publish-python :
64+ if : github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && inputs.publish_python)
65+ runs-on : ubuntu-latest
66+ permissions :
67+ contents : read
68+ steps :
69+ - name : Checkout (manual)
70+ if : github.event_name == 'workflow_dispatch'
71+ uses : actions/checkout@v4
72+
73+ - name : Checkout (release tag commit)
74+ if : github.event_name == 'workflow_run'
75+ uses : actions/checkout@v4
76+ with :
77+ ref : ${{ github.event.workflow_run.head_sha }}
78+
79+ - uses : oven-sh/setup-bun@v2
80+ with :
81+ bun-version : " latest"
82+
83+ - uses : actions/setup-python@v5
84+ with :
85+ python-version : " 3.11"
86+
87+ - name : Install and verify versions
88+ run : bun install --frozen-lockfile && bun run scripts/verify-versions.ts
89+
90+ - name : Build Python package
91+ working-directory : sdks/python
92+ run : |
93+ python3 -m pip install --upgrade pip build twine
94+ python3 -m build
95+
6496 - name : Publish to PyPI
6597 working-directory : sdks/python
6698 run : python3 -m twine upload dist/*
0 commit comments