Skip to content

Commit c2ec506

Browse files
committed
Split publish workflow into multi-arch Docker and PyPI jobs
Replaces the monolithic publish.yml with separate workflows for building and publishing Docker images (full and proxy, for both amd64 and arm64), creating multi-arch Docker manifests, and publishing to PyPI. Updates version to 0.1.28 in both __init__.py and pyproject.toml.
1 parent eebb7c1 commit c2ec506

File tree

9 files changed

+344
-127
lines changed

9 files changed

+344
-127
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Docker Full AMD64
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
build:
8+
name: Build full Docker image for AMD64
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log in to GitHub Container Registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Extract version from tag
27+
id: version
28+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
29+
30+
- name: Build and push full AMD64 image
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: .
34+
file: Dockerfile
35+
push: true
36+
platforms: linux/amd64
37+
tags: |
38+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-amd64
39+
ghcr.io/${{ github.repository }}:latest-amd64
40+
labels: |
41+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
42+
org.opencontainers.image.description=OptiLLM full image with model serving and API routing capabilities (AMD64)
43+
org.opencontainers.image.licenses=Apache-2.0
44+
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
45+
cache-from: type=gha,scope=full-amd64
46+
cache-to: type=gha,scope=full-amd64,mode=max
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Full ARM64
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
build:
8+
name: Build full Docker image for ARM64
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract version from tag
30+
id: version
31+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
32+
33+
- name: Build and push full ARM64 image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
file: Dockerfile
38+
push: true
39+
platforms: linux/arm64
40+
tags: |
41+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-arm64
42+
ghcr.io/${{ github.repository }}:latest-arm64
43+
labels: |
44+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
45+
org.opencontainers.image.description=OptiLLM full image with model serving and API routing capabilities (ARM64)
46+
org.opencontainers.image.licenses=Apache-2.0
47+
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
48+
cache-from: type=gha,scope=full-arm64
49+
cache-to: type=gha,scope=full-arm64,mode=max
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Docker Multi-arch Manifests
2+
on:
3+
workflow_run:
4+
workflows:
5+
- "Docker Proxy AMD64"
6+
- "Docker Proxy ARM64"
7+
- "Docker Full AMD64"
8+
- "Docker Full ARM64"
9+
types: [completed]
10+
11+
jobs:
12+
check-builds:
13+
name: Check if all builds succeeded
14+
runs-on: ubuntu-latest
15+
outputs:
16+
all-success: ${{ steps.check.outputs.result }}
17+
version: ${{ steps.version.outputs.VERSION }}
18+
steps:
19+
- name: Check workflow results
20+
id: check
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const workflows = [
25+
"Docker Proxy AMD64",
26+
"Docker Proxy ARM64",
27+
"Docker Full AMD64",
28+
"Docker Full ARM64"
29+
];
30+
31+
const runId = context.payload.workflow_run.id;
32+
const ref = context.payload.workflow_run.head_sha;
33+
34+
console.log(`Checking workflows for ref: ${ref}`);
35+
36+
// Get all workflow runs for this ref
37+
const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
head_sha: ref,
41+
status: 'completed'
42+
});
43+
44+
const workflowResults = {};
45+
46+
for (const run of runs.workflow_runs) {
47+
if (workflows.includes(run.name)) {
48+
workflowResults[run.name] = run.conclusion;
49+
console.log(`${run.name}: ${run.conclusion}`);
50+
}
51+
}
52+
53+
// Check if all workflows succeeded
54+
const allSuccess = workflows.every(name =>
55+
workflowResults[name] === 'success'
56+
);
57+
58+
console.log(`All workflows successful: ${allSuccess}`);
59+
60+
return allSuccess;
61+
62+
- name: Extract version from workflow
63+
id: version
64+
run: |
65+
VERSION=$(echo "${{ github.event.workflow_run.head_branch }}" | sed 's/refs\/tags\///')
66+
if [[ $VERSION != v* ]]; then
67+
# If not a version tag, use the tag from the triggering release
68+
VERSION="${{ github.event.workflow_run.head_branch }}"
69+
fi
70+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
71+
echo "Extracted version: $VERSION"
72+
73+
create-manifests:
74+
name: Create multi-arch manifests
75+
runs-on: ubuntu-latest
76+
needs: check-builds
77+
if: needs.check-builds.outputs.all-success == 'true'
78+
permissions:
79+
contents: read
80+
packages: write
81+
steps:
82+
- name: Log in to GitHub Container Registry
83+
uses: docker/login-action@v3
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.actor }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Create proxy multi-arch manifest
90+
run: |
91+
VERSION="${{ needs.check-builds.outputs.version }}"
92+
93+
# Create versioned proxy manifest
94+
docker manifest create ghcr.io/${{ github.repository }}:${VERSION}-proxy \
95+
ghcr.io/${{ github.repository }}:${VERSION}-proxy-amd64 \
96+
ghcr.io/${{ github.repository }}:${VERSION}-proxy-arm64
97+
98+
docker manifest push ghcr.io/${{ github.repository }}:${VERSION}-proxy
99+
100+
# Create latest proxy manifest
101+
docker manifest create ghcr.io/${{ github.repository }}:latest-proxy \
102+
ghcr.io/${{ github.repository }}:latest-proxy-amd64 \
103+
ghcr.io/${{ github.repository }}:latest-proxy-arm64
104+
105+
docker manifest push ghcr.io/${{ github.repository }}:latest-proxy
106+
107+
- name: Create full multi-arch manifest
108+
run: |
109+
VERSION="${{ needs.check-builds.outputs.version }}"
110+
111+
# Create versioned full manifest
112+
docker manifest create ghcr.io/${{ github.repository }}:${VERSION} \
113+
ghcr.io/${{ github.repository }}:${VERSION}-amd64 \
114+
ghcr.io/${{ github.repository }}:${VERSION}-arm64
115+
116+
docker manifest push ghcr.io/${{ github.repository }}:${VERSION}
117+
118+
# Create latest full manifest
119+
docker manifest create ghcr.io/${{ github.repository }}:latest \
120+
ghcr.io/${{ github.repository }}:latest-amd64 \
121+
ghcr.io/${{ github.repository }}:latest-arm64
122+
123+
docker manifest push ghcr.io/${{ github.repository }}:latest
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Docker Proxy AMD64
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
build:
8+
name: Build proxy Docker image for AMD64
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log in to GitHub Container Registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Extract version from tag
27+
id: version
28+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
29+
30+
- name: Build and push proxy AMD64 image
31+
uses: docker/build-push-action@v5
32+
with:
33+
context: .
34+
file: Dockerfile.proxy_only
35+
push: true
36+
platforms: linux/amd64
37+
tags: |
38+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-proxy-amd64
39+
ghcr.io/${{ github.repository }}:latest-proxy-amd64
40+
labels: |
41+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
42+
org.opencontainers.image.description=OptiLLM proxy-only image for API routing without model serving capabilities (AMD64)
43+
org.opencontainers.image.licenses=Apache-2.0
44+
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
45+
cache-from: type=gha,scope=proxy-amd64
46+
cache-to: type=gha,scope=proxy-amd64,mode=max
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Proxy ARM64
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
build:
8+
name: Build proxy Docker image for ARM64
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract version from tag
30+
id: version
31+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
32+
33+
- name: Build and push proxy ARM64 image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
file: Dockerfile.proxy_only
38+
push: true
39+
platforms: linux/arm64
40+
tags: |
41+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}-proxy-arm64
42+
ghcr.io/${{ github.repository }}:latest-proxy-arm64
43+
labels: |
44+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
45+
org.opencontainers.image.description=OptiLLM proxy-only image for API routing without model serving capabilities (ARM64)
46+
org.opencontainers.image.licenses=Apache-2.0
47+
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
48+
cache-from: type=gha,scope=proxy-arm64
49+
cache-to: type=gha,scope=proxy-arm64,mode=max

.github/workflows/publish-pypi.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Upload Python Package to PyPI on Release
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
pypi-publish:
8+
name: Publish release to PyPI
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: pypi
12+
url: https://pypi.org/p/optillm
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.x"
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install build
25+
- name: Build package
26+
run: |
27+
python -m build
28+
- name: Publish package distributions to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)