Skip to content
Open
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
22 changes: 15 additions & 7 deletions actions/publish_release_images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,24 @@ runs:
shell: bash
- run: |
current_tag=${GITHUB_REF#refs/*/}
latest_tag=$(git tag --sort=v:refname | tail -n 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe we could log this and current_tag for better visibility.

reg_repo=${{ inputs.registry }}/${{ inputs.organization }}
touch /tmp/tmp-profile
. /tmp/tmp-profile
make docker DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}"
docker images
echo ${{ inputs.password }} | docker login -u ${{ inputs.login }} --password-stdin ${{ inputs.registry }}
make docker-publish DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
if [[ "$current_tag" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
make docker-tag-latest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-publish DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}"
make docker-manifest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}"
if [[ "${current_tag}" == "${latest_tag}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trying this out:

$ git tag --sort=v:refname | tail -n 3
v3.2.1
v3.3.0-rc.0
v3.3.0-rc.1

so if we ship v3.2.2 now, latest will not get applied because of the 3.3 RCs

I'll try to sell it again, how about using docker/metadata-actio to take care of that?
I'm not too familiar with the action, but AI suggested:

      # Use docker/metadata-action to extract version metadata and generate tags
      - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: yourdockerhubusername/yourimage
          tags: |
            type=semver,pattern={{major}}.{{minor}}.{{patch}},default=true
            type=semver,pattern=latest,default=true,when=!pre
            type=semver,pattern=v{{ major }},when=!pre
            type=semver,pattern=v{{ major }}.{{ minor }},when=!pre

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, let me look at docker/metadata-action.

if [[ "${current_tag}" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
make docker-tag-latest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO="${reg_repo}"
make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO="${reg_repo}"
make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO="${reg_repo}"
else
echo "INFO: ${current_tag} is probably a pre-release, skipping latest tag"
fi
else
echo "INFO: ${current_tag} is not ${latest_tag}, skipping latest tag"
fi
shell: bash