diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml index 08779202003..dc31b9418bd 100644 --- a/.github/workflows/release-docker-image.yml +++ b/.github/workflows/release-docker-image.yml @@ -107,9 +107,10 @@ jobs: result-encoding: string script: | const fullTag = '${{ inputs.tag }}'; - const firstMinusIndex = fullTag.indexOf('-'); - if (firstMinusIndex !== -1) { - return fullTag.substring(firstMinusIndex); + if (fullTag.includes('-')) { + const suffixes = fullTag.split('-').slice(1); // Ignore the version part + const firstElements = suffixes.map(suffix => suffix.split('.')[0]); + return "${firstElements.join('-')}""; } else { return ''; } @@ -120,12 +121,14 @@ jobs: with: images: ${{ inputs.image_org }}/${{ inputs.image_name }} tags: | - type=semver,pattern={{version}},priority=950,value=${{ inputs.tag }} - type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag }} - type=semver,pattern={{major}},value=${{ inputs.tag }} - type=ref,event=pr + type=match,pattern=v(\d+),group=1,value=${{ steps.version.outputs.result }} + type=match,pattern=v(\d+.\d+),group=1,value=${{ steps.version.outputs.result }} + type=match,pattern=v(\d+.\d+.\d+),group=1,value=${{ steps.version.outputs.result }} + type=match,pattern=v(.*),group=1,value=${{ steps.version.outputs.result }},suffix= flavor: | - latest=${{ github.event_name == 'release' && !github.event.release.prerelease && steps.suffix.outputs.result == '' }} + suffix=${{ steps.suffix.outputs.result }},onlatest=true + latest=${{ github.event_name == 'release' }} + - name: Login to Docker Hub uses: docker/login-action@v3 with: