Merge branch 'main' into fix-harden-sdk-filters
This commit is contained in:
commit
ef4bd68205
4 changed files with 64 additions and 28 deletions
38
.github/workflows/publish-sdk-python.yml
vendored
38
.github/workflows/publish-sdk-python.yml
vendored
|
|
@ -2,8 +2,11 @@ name: Publish Python SDK
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- 'sdk-py-v*'
|
- main
|
||||||
|
paths:
|
||||||
|
- 'sdks/python/pyproject.toml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
|
@ -22,24 +25,35 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: '3.12'
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: Install build tools
|
- name: Install uv
|
||||||
run: pip install build twine
|
uses: astral-sh/setup-uv@v4
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from pyproject.toml
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
VERSION=${GITHUB_REF_NAME#sdk-py-v}
|
VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml)
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Update version in pyproject.toml
|
- name: Check if version already published
|
||||||
|
id: check
|
||||||
run: |
|
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
|
- name: Build package
|
||||||
run: python -m build
|
if: steps.check.outputs.exists == 'false'
|
||||||
|
run: uv build
|
||||||
|
|
||||||
- name: Publish to PyPI
|
- name: Publish to PyPI
|
||||||
run: twine upload dist/*
|
if: steps.check.outputs.exists == 'false'
|
||||||
|
run: uv publish
|
||||||
env:
|
env:
|
||||||
TWINE_USERNAME: __token__
|
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_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"
|
||||||
|
|
|
||||||
48
.github/workflows/publish-sdk-typescript.yml
vendored
48
.github/workflows/publish-sdk-typescript.yml
vendored
|
|
@ -2,13 +2,19 @@ name: Publish TypeScript SDK
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- 'sdk-ts-v*'
|
- main
|
||||||
|
paths:
|
||||||
|
- 'sdks/typescript/package.json'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Publish to npm
|
name: Publish to npm
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: sdks/typescript
|
working-directory: sdks/typescript
|
||||||
|
|
@ -23,22 +29,36 @@ jobs:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
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
|
- name: Install dependencies
|
||||||
|
if: steps.check.outputs.exists == 'false'
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
if: steps.check.outputs.exists == 'false'
|
||||||
run: npm run build
|
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
|
- name: Publish to npm
|
||||||
run: npm publish --access public
|
if: steps.check.outputs.exists == 'false'
|
||||||
env:
|
run: npm publish --access public --provenance
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
- name: Skip publish (version exists)
|
||||||
|
if: steps.check.outputs.exists == 'true'
|
||||||
|
run: echo "Version ${{ steps.version.outputs.version }} already exists on npm, skipping publish"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "openrag-sdk"
|
name = "openrag-sdk"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = "Official Python SDK for OpenRAG API"
|
description = "Official Python SDK for OpenRAG API"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
@ -59,3 +59,4 @@ select = ["E", "F", "I", "UP"]
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.10"
|
python_version = "3.10"
|
||||||
strict = true
|
strict = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "openrag-sdk",
|
"name": "openrag-sdk",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "Official TypeScript/JavaScript SDK for OpenRAG API",
|
"description": "Official TypeScript/JavaScript SDK for OpenRAG API",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|
@ -56,3 +56,4 @@
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue