GitHub Action
Gradle Metadata action
v1.0
Latest version
Gradle Metadata Action for Docker Buildx Bake.
This action also handles a bake definition file that can be used with the Docker Bake action. You just have to declare an empty target named gradle-metadata-action
and inherit from it.
// docker-bake.hcl
target "docker-metadata-action" {}
target "gradle-metadata-action" {}
target "build" {
inherits = ["docker-metadata-action", "gradle-metadata-action"]
context = "./"
dockerfile = "Dockerfile"
platforms = [
"linux/amd64",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
"linux/386"
]
}
name: ci
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
name/app
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Gradle meta
id: gradle-meta
uses: dockerbakery/gradle-metadata-action@v2
- uses: docker/bake-action@v2
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
${{ steps.gradle-meta.outputs.bake-file }}
targets: build
Following inputs can be used as step.with
keys
Name | Type | Description |
---|---|---|
context |
String | Where to get context data. Allowed options are: workflow (default "current directory). |
version |
String | Set the version of the Gradle project (override the version property) |
Output of
docker buildx bake -f gradle-metadata-action.hcl --print gradle-metadata-action
command.
{
"group": {
"default": {
"targets": [
"gradle-metadata-action"
]
}
},
"target": {
"gradle-metadata-action": {
"args": {
"GRADLE_VERSION": "7.6",
"GRADLE_PROJECT_NAME": "example-project",
"GRADLE_PROJECT_DESCRIPTION": "example-project",
"GRADLE_PROJECT_GROUP": "com.example",
"GRADLE_PROJECT_PROFILE": "dev",
"GRADLE_PROJECT_VERSION": "1.0.0-SNAPSHOT",
"GRADLE_PROJECT_PROFILE": "production",
"GRADLE_BUILD_ARTIFACT_ID": "example-project-1.0.0-SNAPSHOT",
"GRADLE_BUILD_ARTIFACT": "example-project-1.0.0-SNAPSHOT.jar",
"GRADLE_TARGET_COMPATIBILITY": "11",
"GRADLE_SOURCE_COMPATIBILITY": "11",
"JAVA_VENDOR": "AdoptOpenJDK",
"JAVA_VERSION": "11.0.11",
}
}
}
}