Version 1.0.1 (#177) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Upload Python package to PyPI and build/push Docker images. | |
| 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: | | |
| poetry build | |
| poetry publish | |
| # Extract the new version number from pyproject.toml | |
| - name: Extract version for tagging Docker image | |
| working-directory: ./libs/llmstudio | |
| 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 |