Skip to content

Commit

Permalink
[UPDATE] 更新 Gradle 版本号,支持版本选择
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Yeh <[email protected]>
  • Loading branch information
alan-yeh committed Oct 21, 2024
1 parent a28d998 commit 2c910d5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ name: Release Gradle Images

on:
workflow_dispatch:
inputs:
version:
description: 'Gradle Version'
required: true
default: 'all'
type: choice
options:
- 'all'
- '7'
- '8'

jobs:
#################################################################
Expand Down Expand Up @@ -34,6 +44,8 @@ jobs:
#============================ Build ============================
- name: Release Images
uses: docker/bake-action@v5
env:
ENV_VERSION: ${{ github.event.inputs.version }}
with:
targets: gradle
workdir: ./gradle
Expand Down
2 changes: 1 addition & 1 deletion gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Gradle 5: `5`, `5.0`, `5.1`, `5.1.1`, `5.2`, `5.2.1`, `5.3`, `5.3.1`, `5.4`, `5.4.1`, `5.5`, `5.5.1`, `5.6`, `5.6.1`, `5.6.2`, `5.6.3`, `5.6.4`
- Gradle 6: `6`, `6.0`, `6.0.1`, `6.1`, `6.1.1`, `6.2`, `6.2.1`, `6.2.2`, `6.3`, `6.4`, `6.4.1`, `6.5`, `6.5.1`, `6.6`, `6.6.1`, `6.7`, `6.7.1`, `6.8`, `6.8.1`, `6.8.2`, `6.8.3`, `6.9`, `6.9.1`, `6.9.2`, `6.9.3`, `6.9.4`
- Gradle 7: `7`, `7.0`, `7.0.1`, `7.0.2`, `7.1`, `7.1.1`, `7.2`, `7.3`, `7.3.1`, `7.3.2`, `7.3.3`, `7.4`, `7.4.1`, `7.4.2`, `7.5`, `7.5.1`, `7.6`, `7.6.1`, `7.6.2`, `7.6.3`, `7.6.4`
- Gradle 8: `8`, `8.0`, `8.0.1`, `8.0.2`, `8.1`, `8.1.1`, `8.2`, `8.2.1`, `8.3`, `8.4`, `8.5`, `8.6`, `8.7`
- Gradle 8: `8`, `8.0`, `8.0.1`, `8.0.2`, `8.1`, `8.1.1`, `8.2`, `8.2.1`, `8.3`, `8.4`, `8.5`, `8.6`, `8.7`, `8.8`

&emsp;&emsp;本镜像支持以下 OpenJDK [[链接](https://hub.docker.com/r/centralx/openjdk)]版本号:

Expand Down
31 changes: 19 additions & 12 deletions gradle/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ target "_labels" {
}
}

#***************************************************************************
# Global Argument
#***************************************************************************
variable "ENV_VERSION" {
default = "all"
}

#***************************************************************************
# Global Function
#***************************************************************************
function "if" {
params = [condition, true_return]
result = condition ? true_return : ""
result = condition ? [true_return] : []
}

#***************************************************************************
Expand All @@ -45,18 +52,18 @@ function "if" {
target "gradle" {
name = "gradle-${replace(gradle.code, ".", "_")}-jdk${openjdk}-${os}"
matrix = {
gradle = [
{
gradle = flatten([
// 7
if(contains(["all", "7"], "${ENV_VERSION}"), {
major = "7"
// "7.0", "7.0.1", "7.0.2", "7.1", "7.1.1", "7.2", "7.3", "7.3.1", "7.3.2", "7.3.3", "7.4", "7.4.1", "7.4.2", "7.5",
// "7.5.1", "7.6", "7.6.1", "7.6.2", "7.6.3",, "7.6.4",
code = "7.6.4"
}, {
}),
// 8
if(contains(["all", "8"], "${ENV_VERSION}"), {
major = "8"
// "8.0", "8.0.1", "8.0.2", "8.1", "8.1.1", "8.2", "8.2.1", "8.3", "8.4", "8.5", "8.6", `8.7`
code = "8.7"
}
]
code = "8.8"
})
])
openjdk = ["8", "11", "17", "21"]
os = ["ubuntu", "alpine"]
}
Expand All @@ -74,12 +81,12 @@ target "gradle" {
VERSION = "${gradle.code}"
GRADLE_PACKAGE = "https://services.gradle.org/distributions/gradle-${gradle.code}-bin.zip"
}
tags = [
tags = flatten([
// ubuntu 才有的 tag,alpine 没有
if(equal("ubuntu", os), "docker.io/centralx/gradle:${gradle.major}-jdk${openjdk}"),
if(equal("ubuntu", os), "docker.io/centralx/gradle:${gradle.code}-jdk${openjdk}"),

"docker.io/centralx/gradle:${gradle.major}-jdk${openjdk}-${os}",
"docker.io/centralx/gradle:${gradle.code}-jdk${openjdk}-${os}",
]
])
}

0 comments on commit 2c910d5

Please sign in to comment.