ci trigger

This commit is contained in:
phact 2026-01-05 13:06:38 -05:00
parent 82318346ed
commit 918ed6ee54
2 changed files with 46 additions and 17 deletions

View file

@ -2,8 +2,10 @@ name: Publish Python SDK
on:
push:
tags:
- 'sdk-py-v*'
branches:
- main
paths:
- 'sdks/python/pyproject.toml'
jobs:
publish:
@ -25,21 +27,33 @@ jobs:
- name: Install build tools
run: pip install build twine
- 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
if: steps.check.outputs.exists == 'false'
run: python -m build
- name: Publish to PyPI
if: steps.check.outputs.exists == 'false'
run: twine upload dist/*
env:
TWINE_USERNAME: __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"

View file

@ -2,8 +2,10 @@ name: Publish TypeScript SDK
on:
push:
tags:
- 'sdk-ts-v*'
branches:
- main
paths:
- 'sdks/typescript/package.json'
jobs:
publish:
@ -23,22 +25,35 @@ jobs:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- 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
if: steps.check.outputs.exists == 'false'
run: npm publish --access public
env:
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"