Skip to content

Commit

Permalink
Fix tagging java-gradle-build-jib action (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: Yannick Röder <[email protected]>
  • Loading branch information
yordanovsstoyan and yannick-roeder authored Aug 15, 2024
1 parent 6744942 commit 67a7f11
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
17 changes: 7 additions & 10 deletions actions/java-gradle-build-jib/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ inputs:
description: "Name of Docker image."
required: false
default: "${{ github.event.repository.name }}"
image-tags:
description: "Tag of Jib Image (comma separated list)"
required: false
default: "pipeline-${{ github.run_id }}-git-{{ sha }}"
full-image-name:
description: "Full name of image (registry/image:tag) If an image name is provided without a tag, 'latest' will be used. Be careful with registries that dont allow overwriting tags."
description: "Full name of image (registry/image). The image should be provided without a tag."
required: true
allow-insecure-registries:
description: "Whether to allow insecure registries or not. (Default is false)"
Expand Down Expand Up @@ -86,9 +82,10 @@ runs:
with:
images: ${{ inputs.image-name }}
tags: |
event=push,type=raw,value=${{ inputs.image-tags }}
event=pr,type=raw,value=${{ inputs.image-tags }}
event=tag,type=semver,pattern={{ version }}
event=tag,type=semver,pattern={{version}}
event=push,type=raw,value=pipeline-${{ github.run_id }}-git-{{sha}},enable=${{ github.ref_type != 'tag' }}
flavor: |
latest=false
- name: Build Docker image
run: |
Expand All @@ -98,8 +95,8 @@ runs:
-Djib.from.platforms=${{ inputs.platforms }} \
${{ inputs.jib-from-image && format('-Djib.from.image={0}', inputs.jib-from-image) || '' }} \
${{ inputs.class && format('-Djib.container.mainClass={0}', inputs.class) || '' }} \
-Djib.to.image=${{ inputs.full-image-name }} \
-Djib.to.tags=$(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' | sed 's/.*://') \
-Djib.to.image=${{ inputs.full-image-name }}$(echo ${{ steps.meta.outputs.tags }} | sed 's/.*\(:.*\)/\1/') \
$([[ "${{ github.ref_type }}" == "tag" ]] && echo "-Djib.to.tags=latest") \
${{ inputs.gradle-refresh-dependencies == 'true' && '--refresh-dependencies' || '' }} \
${{ inputs.allow-insecure-registries == 'true' && '-Djib.allowInsecureRegistries=true' || '' }}
shell: bash
Expand Down
35 changes: 17 additions & 18 deletions docs/actions/java-gradle-build-jib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@

<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->

| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
| --------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| allow-insecure-registries | string | false | `"false"` | Whether to allow insecure registries or not. (Default is false) |
| class | string | false | | The entrypoint class to be used for the image |
| download-lfs-files | string | false | `"false"` | Whether the Git checkout action should resolve LFS files or not. (Default is false) |
| full-image-name | string | true | | Full name of image (registry/image:tag) If an image name is provided without a tag, 'latest' will be used. Be careful with registries that dont allow overwriting tags. |
| gradle-cache | string | false | `"true"` | Whether Gradle caching is enabled or not. (Default is true) |
| gradle-cache-read-only | string | false | `"${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}"` | Whether Gradle caching should be read-only. By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches. |
| gradle-refresh-dependencies | string | false | `"false"` | Whether Gradle should refresh dependencies. (Default is false) |
| gradle-version | string | false | `"wrapper"` | Gradle version to be installed. (Default is wrapper) |
| image-name | string | false | `"${{ github.event.repository.name }}"` | Name of Docker image. |
| image-tags | string | false | `"pipeline-${{ github.run_id }}-git-{{ sha }}"` | Tag of Jib Image (comma separated list) |
| java-distribution | string | false | `"microsoft"` | Java distribution to be installed. (Default is microsoft) |
| java-version | string | false | `"11"` | Java version to be installed. (Default is 11) |
| jib-from-image | string | false | | The Jib base image to use |
| platforms | string | false | `"linux/amd64,linux/arm64"` | Architectures for the created image (comma separated) |
| subproject | string | false | | The Gradle subproject for which the image should be built (If not specified, an image for the root project will be built) |
| working-directory | string | false | `"."` | Working directory of your Gradle artifacts. (Default is .) |
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
| --------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| allow-insecure-registries | string | false | `"false"` | Whether to allow insecure registries or not. (Default is false) |
| class | string | false | | The entrypoint class to be used for the image |
| download-lfs-files | string | false | `"false"` | Whether the Git checkout action should resolve LFS files or not. (Default is false) |
| full-image-name | string | true | | Full name of image (registry/image). The image should be provided without a tag. |
| gradle-cache | string | false | `"true"` | Whether Gradle caching is enabled or not. (Default is true) |
| gradle-cache-read-only | string | false | `"${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}"` | Whether Gradle caching should be read-only. By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches. |
| gradle-refresh-dependencies | string | false | `"false"` | Whether Gradle should refresh dependencies. (Default is false) |
| gradle-version | string | false | `"wrapper"` | Gradle version to be installed. (Default is wrapper) |
| image-name | string | false | `"${{ github.event.repository.name }}"` | Name of Docker image. |
| java-distribution | string | false | `"microsoft"` | Java distribution to be installed. (Default is microsoft) |
| java-version | string | false | `"11"` | Java version to be installed. (Default is 11) |
| jib-from-image | string | false | | The Jib base image to use |
| platforms | string | false | `"linux/amd64,linux/arm64"` | Architectures for the created image (comma separated) |
| subproject | string | false | | The Gradle subproject for which the image should be built (If not specified, an image for the root project will be built) |
| working-directory | string | false | `"."` | Working directory of your Gradle artifacts. (Default is .) |

<!-- AUTO-DOC-INPUT:END -->

Expand Down

0 comments on commit 67a7f11

Please sign in to comment.