@@ -20,34 +20,55 @@ inputs:
2020 description : Path to Dockerbuild context
2121 type : string
2222 default : " "
23+ platforms :
24+ description : Docker platforms to build
25+ type : string
26+ default : " linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
2327 container_image_name :
2428 description : Name of the container image
2529 type : string
26- default : " "
30+ default : ${{ github.event.repository.name }}
31+ github_token :
32+ type : string
33+ description : Github Token
2734runs :
2835 using : composite
2936 steps :
30- - if : inputs.dockerfile_path != ''
31- run : echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
32- shell : bash
33- - if : inputs.container_image_name != ''
34- run : echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
35- shell : bash
36- - if : inputs.dockerbuild_context != ''
37- run : echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
38- shell : bash
39- - run : |
40- current_tag=${GITHUB_REF#refs/*/}
41- touch /tmp/tmp-profile
42- . /tmp/tmp-profile
43- make docker DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
44- docker images
45- echo ${{ inputs.password }} | docker login -u ${{ inputs.login }} --password-stdin ${{ inputs.registry }}
46- make docker-publish DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
47- make docker-manifest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
48- if [[ "$current_tag" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
49- make docker-tag-latest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
50- make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
51- make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
37+ - name : Determine latest
38+ id : update_latest
39+ run : |
40+ if [ ${{ startsWith(github.ref, 'refs/tags/v3.') }} ]
41+ then
42+ echo "::set-output name=latest::auto"
43+ else
44+ echo "::set-output name=latest::false"
5245 fi
53- shell: bash
46+ - name : Docker meta
47+ id : meta
48+ uses : docker/metadata-action@v5
49+ with :
50+ github-token : ${{ inputs.github_token }}
51+ images : |
52+ ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.container_image_name }}
53+ flavor : |
54+ latest=${{ steps.update_latest.outputs.latest }}
55+ tags : |
56+ type=semver,pattern={{version}}
57+ type=semver,pattern={{major}}.{{minor}}
58+ type=semver,pattern={{major}}
59+ - name : Login to DockerHub
60+ if : github.event_name != 'pull_request'
61+ uses : docker/login-action@v3
62+ with :
63+ registry : ${{ inputs.registry }}
64+ username : ${{ inputs.login }}
65+ password : ${{ inputs.password }}
66+ - name : Build and push
67+ uses : docker/build-push-action@v6
68+ with :
69+ context : ${{ inputs.dockerbuild_context || '.' }}
70+ file : ${{ inputs.dockerfile_path }}
71+ platforms : ${{ inputs.platforms }}
72+ push : ${{ github.event_name != 'pull_request' }}
73+ tags : ${{ steps.meta.outputs.tags }}
74+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments