Skip to content

Version 1.0.2 (#180) #2

Version 1.0.2 (#180)

Version 1.0.2 (#180) #2

name: llmstudio to PyPI.
on:
push:
branches:
- main
paths:
- "libs/llmstudio/**"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v2
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
# Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
# Configure Poetry with PyPI token
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
# Build and publish package to PyPI
- name: Build and publish to PyPI
working-directory: ./libs/llmstudio
run: |
CURRENT_VERSION=$(poetry version --short)
FINAL_VERSION=$(echo "$CURRENT_VERSION" | sed -E 's/[a-zA-Z]+[0-9]*//')
echo "Checking for llmstudio==$FINAL_VERSION on PyPI..."
if python -m pip install llmstudio==$FINAL_VERSION --dry-run >/dev/null 2>&1; then
echo "Package llmstudio==$FINAL_VERSION is already available on PyPI. Please bump version."
exit 1
fi
done
poetry version "$FINAL_VERSION"
echo "Updated version: $(poetry version --short)"
poetry build
poetry publish
- name: Commit and push updated pyproject.toml
working-directory: ./libs/llmstudio
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add pyproject.toml
git commit -m "[fix] bump release version in pyproject.toml"
git push
# Wait for the package to become available on PyPI
- name: Wait for PyPI to update
run: |
echo "Checking for llmstudio==${{ env.VERSION }} on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio==${{ env.VERSION }} is available on PyPI."
break
else
echo "Package llmstudio==${{ env.VERSION }} not available yet. Waiting 15 seconds..."
sleep 15
fi
if [ $i -eq 10 ]; then
echo "Package did not become available in time."
exit 1
fi
done