Workflow file for this run
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 and Docker Image on Release | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| pypi-publish: | |
| name: Publish release to PyPI | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/optillm | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| docker-publish: | |
| name: Publish Docker image | |
| runs-on: ubuntu-22.04 | |
| needs: pypi-publish | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Add aggressive cleanup before any Docker operations | |
| - name: Free disk space | |
| run: | | |
| # Clean Docker | |
| docker system prune -af | |
| docker image prune -af | |
| docker builder prune -af | |
| df -h | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| image=moby/buildkit:buildx-stable-1 | |
| network=host | |
| buildkitd-flags: --debug | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Extract metadata for proxy_only image | |
| - name: Extract metadata for proxy_only Docker | |
| id: meta-proxy | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| flavor: | | |
| suffix=-proxy | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest | |
| # Build and push proxy_only multi-arch | |
| - name: Build and push proxy_only Docker image (multi-arch) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile.proxy_only | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta-proxy.outputs.tags }} | |
| labels: ${{ steps.meta-proxy.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| outputs: type=registry,compression=zstd,compression-level=5 | |
| # Cleanup after proxy build | |
| - name: Cleanup after proxy build | |
| run: | | |
| docker system prune -af | |
| docker builder prune -af | |
| df -h | |
| # Extract metadata for full image | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| latest | |
| # Build full image multi-arch | |
| - name: Build and push Docker image (multi-arch) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| outputs: type=registry,compression=zstd,compression-level=5 |