Merge branch 'main' into fix-harden-sdk-filters

This commit is contained in:
Sebastián Estévez 2026-01-05 16:25:15 -05:00 committed by GitHub
commit ef4bd68205
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 64 additions and 28 deletions

View file

@ -2,8 +2,11 @@ name: Publish Python SDK
on:
push:
tags:
- 'sdk-py-v*'
branches:
- main
paths:
- 'sdks/python/pyproject.toml'
workflow_dispatch:
jobs:
publish:
@ -22,24 +25,35 @@ jobs:
with:
python-version: '3.12'
- name: Install build tools
run: pip install build twine
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Extract version from tag
- name: Extract version from pyproject.toml
id: version
run: |
VERSION=${GITHUB_REF_NAME#sdk-py-v}
VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update version in pyproject.toml
- name: Check if version already published
id: check
run: |
sed -i "s/^version = .*/version = \"${{ steps.version.outputs.version }}\"/" pyproject.toml
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://pypi.org/pypi/openrag-sdk/${{ steps.version.outputs.version }}/json)
if [ "$HTTP_STATUS" = "200" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build package
run: python -m build
if: steps.check.outputs.exists == 'false'
run: uv build
- name: Publish to PyPI
run: twine upload dist/*
if: steps.check.outputs.exists == 'false'
run: uv publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
- name: Skip publish (version exists)
if: steps.check.outputs.exists == 'true'
run: echo "Version ${{ steps.version.outputs.version }} already exists on PyPI, skipping publish"

View file

@ -2,13 +2,19 @@ name: Publish TypeScript SDK
on:
push:
tags:
- 'sdk-ts-v*'
branches:
- main
paths:
- 'sdks/typescript/package.json'
workflow_dispatch:
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: sdks/typescript
@ -23,22 +29,36 @@ jobs:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Update npm to latest
run: npm install -g npm@latest
- name: Extract version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if version already published
id: check
run: |
if npm view openrag-sdk@${{ steps.version.outputs.version }} version 2>/dev/null; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies
if: steps.check.outputs.exists == 'false'
run: npm ci
- name: Build
if: steps.check.outputs.exists == 'false'
run: npm run build
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF_NAME#sdk-ts-v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update package version
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: steps.check.outputs.exists == 'false'
run: npm publish --access public --provenance
- name: Skip publish (version exists)
if: steps.check.outputs.exists == 'true'
run: echo "Version ${{ steps.version.outputs.version }} already exists on npm, skipping publish"

View file

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "openrag-sdk"
version = "0.1.1"
version = "0.1.2"
description = "Official Python SDK for OpenRAG API"
readme = "README.md"
license = "MIT"
@ -59,3 +59,4 @@ select = ["E", "F", "I", "UP"]
[tool.mypy]
python_version = "3.10"
strict = true

View file

@ -1,6 +1,6 @@
{
"name": "openrag-sdk",
"version": "0.1.1",
"version": "0.1.2",
"description": "Official TypeScript/JavaScript SDK for OpenRAG API",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
@ -56,3 +56,4 @@
"node": ">=18.0.0"
}
}