Skip to content

Commit 1262eb8

Browse files
authored
chore(build): update image tagging and DockerHub integration in CI workflow (#834)
1 parent 37aa348 commit 1262eb8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/publish-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
types: [published]
55
env:
66
IMAGE_NAME: ghcr.io/${{ github.repository }}
7+
IMAGE_NAME_DH: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
78
jobs:
89
publish-release:
910
permissions:
@@ -25,7 +26,13 @@ jobs:
2526
registry: ghcr.io
2627
username: ${{ github.actor }}
2728
password: ${{ secrets.GITHUB_TOKEN }}
28-
- name: Publish artifact
29+
- name: Login to DockerHub
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
35+
- name: Publish artifact and images
2936
env:
3037
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
3138
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
@@ -38,6 +45,7 @@ jobs:
3845
run: |
3946
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
4047
IMAGE=${IMAGE_NAME}:${NEW_VERSION}
48+
IMAGE_DH=${IMAGE_NAME_DH}:${NEW_VERSION}
4149
echo "Releasing new version ${NEW_VERSION} of $IMAGE"
4250
./gradlew -Pversion=${NEW_VERSION} publishAllPublicationsToGithubPackagesRepository publishAndReleaseToMavenCentral --no-configuration-cache
43-
./gradlew jib --image="${IMAGE}"
51+
./gradlew jib --image="${IMAGE}" --image="${IMAGE_DH}"

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ jib {
207207
}
208208
image = "cgr.dev/chainguard/jre:latest-dev"
209209
}
210+
211+
to {
212+
// Image tags are set via the CLI (--image=...) in the workflow
213+
// But can set defaults here as well (optional)
214+
tags = setOf("latest")
215+
}
216+
210217
container {
211218
ports = listOf("8080")
212219
mainClass = mainClassKt

0 commit comments

Comments
 (0)