Skip to content

Commit ce446c3

Browse files
committed
#369 Enable additional Docker tags
Allow a push of the Docker image with additional tags to override or extend given images.
1 parent 7aacf0c commit ce446c3

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.github/workflows/gradle-build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
pull_request:
88
push:
99
workflow_dispatch:
10+
inputs:
11+
additional_tags:
12+
description: 'Additional tags for Docker images (comma-separated)'
13+
required: false
14+
type: string
1015

1116
jobs:
1217
build-artifacts:
@@ -150,7 +155,9 @@ jobs:
150155
restore-keys: ${{ runner.os }}-gradle-caches
151156

152157
- name: Execute Gradle build
153-
run: ./gradlew dockerPush --scan --stacktrace
158+
env:
159+
ADDITIONAL_TAGS: ${{ inputs.additional_tags }}
160+
run: ./gradlew dockerPush -Ddocker.image.additional.tags="${ADDITIONAL_TAGS}" --scan --stacktrace
154161

155162
- name: Collect state upon failure
156163
if: failure()

action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ runs:
1010
using: 'docker'
1111
# If the image tag changes, e.g., to v3, the action in the test workflow (workflows/gradle-build.yml) must be adjusted accordingly
1212
image: 'docker://ghcr.io/aim42/hsc:v2'
13-
entrypoint: '/bin/sh'
13+
entrypoint: '/hsc.sh'
1414
args:
15-
- -c
16-
- java -jar /hsc.jar ${{ inputs.args }}
15+
- ${{ inputs.args }}

htmlSanityCheck-cli/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@ def dockerTags(Project project) {
4343
result += ['v' + project.version.substring(0, 1), 'latest']
4444
}
4545

46+
def additionalTags = System.getProperty('docker.image.additional.tags')
47+
if (additionalTags) {
48+
logger.quiet("Adding additional tags '${additionalTags}'")
49+
result += additionalTags.split(',').collect { it.trim() }
50+
}
51+
4652
return result
4753
}
4854

4955
docker {
5056
registry = "ghcr.io"
5157
repository = "aim42/hsc"
52-
buildArgs = [VERSION: project.version]
58+
buildArgs = ["VERSION": "${project.version}" as String]
5359
dockerFilePath = "."
5460
tags = dockerTags(project)
5561
applyLatestTag = false

0 commit comments

Comments
 (0)