Skip to content

Commit

Permalink
feat(): handle major and minor Docker images publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
e7d committed Mar 28, 2024
1 parent 646a4c0 commit a40a81b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ jobs:
run: |
GITHUB_REF=${{ github.ref }}
TAG=${GITHUB_REF#refs/tags/}
docker buildx imagetools create \
--tag ${{ vars.DOCKERHUB_IMAGE }}:${TAG} \
${{ vars.DOCKERHUB_IMAGE }}:${{ github.sha }}
TAGS="--tag ${{ vars.DOCKERHUB_IMAGE }}:${TAG}" # full version
if [ "${TAG}" !== *-* ]; then # if not a pre-release
TAGS+=" --tag ${{ vars.DOCKERHUB_IMAGE }}:"${TAG%%.*}" # major version
TAGS+=" --tag ${{ vars.DOCKERHUB_IMAGE }}:"${TAG%.*}" # major.minor version
fi
docker buildx imagetools create ${TAG_STR} ${{ vars.DOCKERHUB_IMAGE }}:${{ github.sha }}
- name: Push "latest"
if: github.ref == 'refs/heads/main'
run: |
Expand Down

0 comments on commit a40a81b

Please sign in to comment.