Skip to content

Commit 2c5166f

Browse files
authored
Only create image with latest tag on release (#120)
Signed-off-by: Shmuel Kallner <[email protected]>
1 parent 0fc60ce commit 2c5166f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/actions/docker-build-and-push/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ runs:
3232

3333
- name: Build image
3434
run: |
35+
if [[ ${{ inputs.prerelease }} ]]; then
36+
LATEST_TAG=""
37+
else
38+
LATEST_TAG="-t ${{ inputs.registry }}/${{ inputs.image-name }}:latest"
39+
fi
3540
docker buildx build \
3641
--platform linux/amd64,linux/arm64 \
3742
-t ${{ inputs.registry }}/${{ inputs.image-name }}:${{ inputs.tag }} \
38-
-t ${{ inputs.registry }}/${{ inputs.image-name }}:latest \
39-
--push .
43+
${LATEST_TAG} --push .
4044
shell: bash

.github/workflows/ci-release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
else
3434
echo "tag=latest" >> "$GITHUB_OUTPUT"
3535
fi
36+
PRE_RELEASE=${{ github.event_name != 'release' || github.event.release.prerelease }}
37+
echo "prerelease=${PRE_RELEASE}" >> "$GITHUB_OUTPUT"
3638
shell: bash
3739

3840
- name: Build and push image
@@ -42,6 +44,7 @@ jobs:
4244
image-name: ${{ steps.version.outputs.project_name }}
4345
registry: ghcr.io/llm-d
4446
github-token: ${{ secrets.GHCR_TOKEN }}
47+
prerelease: ${{ steps.tag.outputs.prerelease }}
4548

4649
- name: Run Trivy scan
4750
uses: ./.github/actions/trivy-scan

0 commit comments

Comments
 (0)