mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-12 23:01:07 +00:00
54 lines
2 KiB
YAML
54 lines
2 KiB
YAML
name: Publish Agent Framework Python
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "packages/agent-framework-python/pyproject.toml"
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
defaults:
|
|
run:
|
|
working-directory: ./packages/agent-framework-python
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Check if version changed
|
|
id: version-check
|
|
run: |
|
|
LOCAL_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['name'])")
|
|
PIP_VERSION=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/json" 2>/dev/null | python -c "import sys,json; print(json.load(sys.stdin)['info']['version'])" 2>/dev/null || echo "0.0.0")
|
|
if [ "$LOCAL_VERSION" = "$PIP_VERSION" ]; then
|
|
echo "Version $LOCAL_VERSION already published, skipping."
|
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "Publishing $LOCAL_VERSION (PyPI has $PIP_VERSION)"
|
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Install build dependencies
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
run: pip install hatchling build
|
|
|
|
- name: Build package
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
run: python -m build
|
|
|
|
- name: Publish to PyPI
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
packages-dir: packages/agent-framework-python/dist/
|