Skip to content

Commit

Permalink
Support multiple tags for jib images (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 authored and DerTiedemann committed Feb 20, 2025
1 parent 050a2e7 commit 4729339
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/java-gradle-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:

- name: Jib build
id: build-image
uses: bakdata/ci-templates/actions/java-gradle-build-jib@1.55.0
uses: bakdata/ci-templates/actions/java-gradle-build-jib@1.57.0
with:
java-distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
Expand Down
16 changes: 4 additions & 12 deletions actions/java-gradle-build-jib/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Build Multi-Platform image using Gradle"
outputs:
image-tag:
description: "The tag of the docker image."
value: ${{ steps.tag.outputs.name }}
value: ${{ steps.meta.outputs.tags }}

inputs:
platforms:
Expand Down Expand Up @@ -78,18 +78,11 @@ runs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.event.repository.name }}
tags: |
event=tag,type=semver,pattern={{version}}
event=pr,type=ref
event=push,type=raw,value=pipeline-${{ github.run_id }}-git-{{sha}},enable=${{ github.ref_type != 'tag' }}
flavor: |
latest=false
- name: Create tag output
id: tag
run: echo "name=$(echo ${{ steps.meta.outputs.tags }} | sed 's/.*:\(.*\)/\1/')" >> "$GITHUB_OUTPUT"
shell: bash
working-directory: ${{ inputs.working-directory }}
sep-tags: ','

- name: Build Docker image
run: |
Expand All @@ -99,8 +92,7 @@ runs:
${{ inputs.jib-from-image && format('-Djib.from.image={0}', inputs.jib-from-image) || '' }} \
${{ inputs.class && format('-Djib.container.mainClass={0}', inputs.class) || '' }} \
${{ inputs.repository && format('-DjibImage.repository={0}', inputs.repository) || '' }} \
-DjibImage.tag=${{ steps.tag.outputs.name }} \
$([[ "${{ github.ref_type }}" == "tag" ]] && echo "-Djib.to.tags=latest") \
-DjibImage.tags=${{ steps.meta.outputs.tags }} \
${{ inputs.gradle-refresh-dependencies == 'true' && '--refresh-dependencies' || '' }} \
${{ inputs.allow-insecure-registries == 'true' && '-Djib.allowInsecureRegistries=true' || '' }}
shell: bash
Expand Down

0 comments on commit 4729339

Please sign in to comment.