Skip to content

Version 1.0.1 (#177) #1

Version 1.0.1 (#177)

Version 1.0.1 (#177) #1

name: Upload Python package to PyPI and build/push Docker images.
on:
push:
branches:
- main
paths:
- "libs/proxy/**"
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/proxy
run: |
poetry build
poetry publish
# Extract the new version number from pyproject.toml
- name: Extract version for tagging Docker image
working-directory: ./libs/proxy
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
# Wait for the package to become available on PyPI
- name: Wait for PyPI to update
run: |
echo "Checking for llmstudio-proxy==${{ env.VERSION }} on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio-proxy==${{ env.VERSION }} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio-proxy==${{ env.VERSION }} is available on PyPI."
break
else
echo "Package llmstudio-proxy==${{ 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
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version for tagging Docker image
working-directory: ./libs/proxy
id: get_version
run: echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
- name: Build Docker images
working-directory: ./deploy
run: |
make version=${{ env.VERSION }} build-llmstudio-proxy
- name: Push Docker images
run: |
docker push tensoropsai/llmstudio-proxy:${{ env.VERSION }}