Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(build-deploy.yml): correctly set Docker latest tag only on release versions #1695

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ jobs:
uses: docker/metadata-action@v4.3.0
with:
images: ${{ env.IMAGE_NAME }}
# Customize the generation of Docker `latest` tag
# Tag with `latest` the git tags that do not have a "pre-release" component in the end (e.g. `3.0.0`)
# Avoid tagging with `latest` the git tag that have a "pre-release" component in the end (e.g. `3.0.0b1`)
# If no git tag, fallback to branch or PR name
tags: |
# If the git tag follows PEP440 conventions, use it as the resulting docker tag (both releases and pre-releases)
type=pep440,pattern={{version}}

# If the git tag does NOT have a pre-release ending (e.g. `3.0.0`), it is a release version to be tagged as `latest`
type=match,value=latest,pattern=pattern=^\d\.\d+\.\d+$

# If no git tag is used, fallback to tagging with branch or PR name
type=ref,event=branch
type=ref,event=pr

# Build and push Docker image with Buildx (push image only with a tag or push on `dev` branch)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
Expand Down