Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .github/workflows/upload-pypi-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python package to PyPI as dev pre-release
name: Upload Python package to PyPI as dev release and build/push Docker image.

on:
workflow_dispatch:
Expand Down Expand Up @@ -39,3 +39,48 @@ jobs:
git add pyproject.toml
git commit -m "[fix] bump prerelease version in pyproject.toml"
git push

# Wait for PyPI to update
- name: Wait for PyPI to update
run: |
VERSION=$(poetry version --short)
echo "Checking for llmstudio==$VERSION on PyPI..."
for i in {1..10}; do
if python -m pip install llmstudio==${VERSION} --dry-run >/dev/null 2>&1; then
echo "Package llmstudio==${VERSION} is available on PyPI."
break
else
echo "Package llmstudio==${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

# Docker build and push section
- 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
id: get_version
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV

- name: Build and tag Docker image
run: |
docker build \
--build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \
-t tensoropsai/llmstudio:${{ env.VERSION }} \
.

- name: Push Docker image to Docker Hub
run: |
docker push tensoropsai/llmstudio:${{ env.VERSION }}
56 changes: 55 additions & 1 deletion .github/workflows/upload-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python package to PyPI
name: Upload Python package to PyPI and build/push Docker images.

on:
push:
Expand All @@ -11,23 +11,77 @@ 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
run: |
poetry build
poetry publish

# Extract the new version number from pyproject.toml
- name: Extract version for tagging Docker image
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==${{ 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

# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Build and tag Docker images with both :latest and :[NEW_VERSION]
- name: Build and tag Docker images
run: |
docker build \
--build-arg LLMSTUDIO_VERSION=${{ env.VERSION }} \
-t tensoropsai/llmstudio:latest \
-t tensoropsai/llmstudio:${{ env.VERSION }} \
.

# Push both Docker images to Docker Hub
- name: Push Docker images to Docker Hub
run: |
docker push tensoropsai/llmstudio:${{ env.VERSION }}
docker push tensoropsai/llmstudio:latest
2 changes: 1 addition & 1 deletion llmstudio/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def server(ui):


if __name__ == "__main__":
main()
main()