Skip to content

Commit b91e8e8

Browse files
authored
Merge pull request #16 from EdwinBetanc0urt/bugfix/pre-release-replace-latest-tag
fix: Pre-Release replace docker `latest` and `alpine` tags.
2 parents a5fa745 + b64bbeb commit b91e8e8

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

.github/workflows/publish.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,26 +143,39 @@ jobs:
143143
run: |
144144
unzip artifacts/adempiere-processors-service.zip -d docker/
145145
146-
- name: Login to GitHub Container Registry
146+
- name: Login to Container Registry
147147
uses: docker/login-action@v3
148148
with:
149149
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
150150
username: ${{ secrets.DOCKER_USERNAME }}
151151
password: ${{ secrets.DOCKER_TOKEN }}
152+
153+
- name: Set Docker Alpine Tags
154+
id: set_tags_alpine
155+
run: |
156+
# Get the release type
157+
IS_PRE_RELEASE=${{ github.event.release.prerelease }}
158+
# Set the base tags, always include the specific version tag
159+
TAGS="${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}-alpine"
160+
# If it's not a pre-release, add the "latest" tag
161+
if [[ "$IS_PRE_RELEASE" == "false" ]]; then
162+
TAGS+=",${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine"
163+
fi
164+
# Set the output variable for the next step to use
165+
echo "tags_to_push=$TAGS" >> $GITHUB_OUTPUT
166+
152167
- name: Push alpine image in Docker Hub
153168
uses: docker/build-push-action@v6
154169
with:
155170
context: .
156171
file: docker/alpine.Dockerfile
157172
push: true
158-
tags: |
159-
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine-${{ github.event.release.tag_name }}
160-
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine
173+
tags: ${{ steps.set_tags_alpine.outputs.tags_to_push }}
161174

162175
# TODO: Download .tar and add docker image without uncompress
163176
# Publish docker multiplatform image in Docker Hub Registry to application
164177
push-imame-dhr:
165-
name: Push docker multiplatform image to Docker Hub
178+
name: Push docker ubuntu multiplatform image to Docker Hub
166179
needs:
167180
- check-docker-secrets
168181
# Skip step based on secret
@@ -188,20 +201,32 @@ jobs:
188201
- name: Setup Docker Buildx
189202
uses: docker/setup-buildx-action@v3
190203

191-
- name: Login to GitHub Container Registry
204+
- name: Login to Container Registry
192205
uses: docker/login-action@v3
193206
with:
194207
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
195208
username: ${{ secrets.DOCKER_USERNAME }}
196209
password: ${{ secrets.DOCKER_TOKEN }}
197210

198-
- name: Push noble image in Docker Hub
211+
- name: Set Docker Tags
212+
id: set_tags
213+
run: |
214+
# Get the release type
215+
IS_PRE_RELEASE=${{ github.event.release.prerelease }}
216+
# Set the base tags, always include the specific version tag
217+
TAGS="${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}"
218+
# If it's not a pre-release, add the "latest" tag
219+
if [[ "$IS_PRE_RELEASE" == "false" ]]; then
220+
TAGS+=",${{ secrets.DOCKER_HUB_REPO_NAME }}:latest"
221+
fi
222+
# Set the output variable for the next step to use
223+
echo "tags_to_push=$TAGS" >> $GITHUB_OUTPUT
224+
225+
- name: Push ubuntu image in Docker Hub
199226
uses: docker/build-push-action@v6
200227
with:
201228
context: .
202-
file: docker/noble.Dockerfile
229+
file: docker/ubuntu.Dockerfile
203230
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
204231
push: true
205-
tags: |
206-
${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}
207-
${{ secrets.DOCKER_HUB_REPO_NAME }}:latest
232+
tags: ${{ steps.set_tags.outputs.tags_to_push }}

0 commit comments

Comments
 (0)