Files
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

77 lines
2.5 KiB
YAML

name: Publish SDK
# Publishes the drop-in compress() SDKs (packages/node-lean-ctx -> npm `lean-ctx-sdk`,
# packages/python-lean-ctx -> PyPI `lean-ctx-sdk`). These versions independently of the
# engine, so they are NOT part of release.yml (engine `v*` tags). Trigger manually, or
# push an `sdk-v*` tag. Every step is idempotent: an already-published version is a no-op.
on:
workflow_dispatch:
inputs:
targets:
description: "Which registries to publish to"
type: choice
default: both
options: [both, npm, pypi]
push:
tags:
- 'sdk-v[0-9]*'
permissions:
contents: read
jobs:
publish-npm:
name: Publish lean-ctx-sdk to npm
if: ${{ github.event_name == 'push' || inputs.targets == 'both' || inputs.targets == 'npm' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # v4
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Build, test, publish
working-directory: packages/node-lean-ctx
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
npm ci
npm run build
npm test
PKG_VERSION="$(node -p "require('./package.json').version")"
if npm view "lean-ctx-sdk@${PKG_VERSION}" version >/dev/null 2>&1; then
echo "npm already has lean-ctx-sdk@${PKG_VERSION} — skipping publish."
exit 0
fi
npm publish --access public
publish-pypi:
name: Publish lean-ctx-sdk to PyPI
if: ${{ github.event_name == 'push' || inputs.targets == 'both' || inputs.targets == 'pypi' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build and upload (skip if no token / already present)
working-directory: packages/python-lean-ctx
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
set -euo pipefail
if [ -z "${TWINE_PASSWORD}" ]; then
echo "PYPI_TOKEN secret not set — skipping PyPI publish."
exit 0
fi
python -m pip install --quiet build twine
python -m build
python -m twine upload --skip-existing dist/*