Skip to content

Commit

Permalink
Support scoping of java-gradle-build-jib to Gradle subproject (#129)
Browse files Browse the repository at this point in the history
* Support scoping java-gradle-build-jib to Gradle subproject

* Show executed jibBuildTar task more prominently in WF logs

* Upload subproject's tar as artifact

* Update readme
  • Loading branch information
JakobEdding authored Aug 16, 2023
1 parent c3c2cec commit 286a752
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
19 changes: 10 additions & 9 deletions actions/java-gradle-build-jib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ This action builds an image tarball using [Jib Gradle](https://github.com/Google

## Input Parameters

| Name | Required | Default Value | Type | Description |
| ------------------- | :------: | :------------: | :-----: | ------------------------------------------------------------------------------------------------------------- |
| image-artifact-name || image-artifact | string | Artifact name to upload tarball image, see <https://github.com/actions/upload-artifact> |
| java-distribution || microsoft | string | [Java distribution](https://github.com/actions/setup-java#supported-distributions) to be installed |
| java-version || 11 | string | Java version to be installed |
| gradle-version || wrapper | string | [Gradle version](https://github.com/gradle/gradle-build-action#use-a-specific-gradle-version) to be installed |
| gradle-cache || true | boolean | Whether Gradle caching is enabled or not |
| working-directory || "." | string | Working directory of your Gradle artifacts |
| download-lfs-files || false | boolean | Whether the Git checkout action should resolve LFS files or not |
| Name | Required | Default Value | Type | Description |
| ------------------- | :------: | :------------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------- |
| image-artifact-name || image-artifact | string | Artifact name to upload tarball image, see <https://github.com/actions/upload-artifact> |
| java-distribution || microsoft | string | [Java distribution](https://github.com/actions/setup-java#supported-distributions) to be installed |
| java-version || 11 | string | Java version to be installed |
| gradle-version || wrapper | string | [Gradle version](https://github.com/gradle/gradle-build-action#use-a-specific-gradle-version) to be installed |
| gradle-cache || true | boolean | Whether Gradle caching is enabled or not |
| working-directory || "." | string | Working directory of your Gradle artifacts |
| download-lfs-files || false | boolean | Whether the Git checkout action should resolve LFS files or not |
| subproject || | string | The Gradle subproject for which the tarball image should be built (If not specified, a tarball image for the root project will be built) |

## Usage

Expand Down
11 changes: 9 additions & 2 deletions actions/java-gradle-build-jib/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ inputs:
description: "Whether the Git checkout action should resolve LFS files or not. (Default is false)"
required: false
default: false
subproject:
description: "The Gradle subproject for which the tarball image should be built (If not specified, a tarball image for the root project will be built)"
required: false
runs:
using: "composite"
steps:
Expand All @@ -51,13 +54,17 @@ runs:
gradle-cache: ${{ inputs.gradle-cache }}

- name: Build Docker image
run: ./gradlew --info --stacktrace jibBuildTar --image=${{ inputs.image-name }} -x test
run: |
./gradlew ${{ inputs.subproject && format('{0}:', inputs.subproject) || '' }}jibBuildTar \
--info --stacktrace \
--image=${{ inputs.image-name }} \
-x test
shell: bash
working-directory: ${{ inputs.working-directory }}

- name: Upload tarball image artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.image-artifact-name }}
path: build/jib-image.tar
path: ${{ inputs.subproject && format('{0}/', inputs.subproject) || '' }}build/jib-image.tar
retention-days: 1

0 comments on commit 286a752

Please sign in to comment.