Skip to content

Commit eef78cd

Browse files
authored
CI: Exclude preview releases from "latest" docker release tag
1 parent f24c11f commit eef78cd

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/build-release-binaries.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,31 @@ jobs:
145145
username: ${{ secrets.DOCKERHUB_USERNAME }}
146146
password: ${{ secrets.DOCKERHUB_TOKEN }}
147147

148+
- name: Set Docker tags
149+
id: docker_tags
150+
run: |
151+
if [[ ${{ github.event.release.tag_name }} == "preview" ]]; then
152+
echo "::set-output name=preview::true"
153+
else
154+
echo "::set-output name=preview::false"
155+
fi
156+
148157
- name: Build and push Docker image
149158
uses: docker/build-push-action@v4
150159
with:
151160
context: .
152161
file: ./Dockerfile
153162
push: true
154163
tags: |
155-
${{ env.DOCKER_IMAGE_NAME }}:latest
156164
${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}
165+
${{ env.DOCKER_IMAGE_NAME }}:latest
166+
if: steps.docker_tags.outputs.preview == 'false'
167+
168+
- name: Build and push Docker image without latest tag (preview release)
169+
uses: docker/build-push-action@v4
170+
with:
171+
context: .
172+
file: ./Dockerfile
173+
push: true
174+
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}
175+
if: steps.docker_tags.outputs.preview == 'true'

0 commit comments

Comments
 (0)