Skip to content

Commit 842bcbc

Browse files
committed
ci: publish operator image to GHCR on push/tag
New workflow builds the multi-stage Dockerfile and pushes to ghcr.io/michelecampi/vllm-coldstart-operator. Tags: short SHA, branch, semver from v* tags, and latest on main. Builds (no push) on PRs to catch Dockerfile regressions. Separate from ci.yml to keep the test pipeline independent.
1 parent 28f3405 commit 842bcbc

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [main]
9+
10+
# Cancel superseded runs on the same ref.
11+
concurrency:
12+
group: release-image-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
jobs:
20+
image:
21+
name: build + push (ghcr)
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
# Login only when we intend to push (not on PRs).
30+
- name: Log in to GHCR
31+
if: github.event_name != 'pull_request'
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ghcr.io/${{ github.repository }}
43+
tags: |
44+
type=sha,prefix=
45+
type=ref,event=branch
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
type=raw,value=latest,enable={{is_default_branch}}
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
platforms: linux/amd64
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
cache-from: type=gha
59+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)