11name : Publish Docker image
2- run-name : Publish branch ${{ github.ref_name }} to tags ${{ inputs.dockerTags }}
2+ run-name : Publish branch ${{ github.ref_name }} to tags ${{ inputs.docker-tags }}
33
44on :
55 workflow_dispatch :
66 inputs :
7- dockerTags :
7+ docker-tags :
88 description : ' Docker tag'
99 required : true
10- baseImage :
10+ base-image :
1111 description : ' Base image'
1212 required : true
1313 default : ' ghcr.io/wavesplatform/waves:snapshot'
@@ -25,24 +25,46 @@ jobs:
2525 id-token : write
2626 steps :
2727 - uses : actions/checkout@v4
28+ - uses : regclient/actions/regctl-installer@4d6888fcc4842c9630f60ebc91715a45dd9bd7a3
2829 - uses : proudust/gh-describe@70f72d4f6304ea053cf5a3d71c36211d5acc0c73
2930 id : ghd
30- - uses : actions/setup-java@v4
31- with :
32- distribution : ' temurin'
33- java-version : ' 11'
34- cache : ' sbt'
35- - uses : sbt/setup-sbt@v1
31+ - name : Prepare base image and consensus client version
32+ run : |
33+ BASE_IMAGE=${{ inputs.base-image }}
34+ BASE_IMAGE=${BASE_IMAGE:-$(head -n1 docker/Dockerfile | cut -d= -f2-)}
35+ echo "base-image=$BASE_IMAGE" >> "$GITHUB_OUTPUT"
36+ echo "base-image-digest=$(regctl manifest digest $BASE_IMAGE)" >> "$GITHUB_OUTPUT"
37+ echo "cc-version=$(echo ${{ steps.ghd.outputs.describe }} | cut -c 2-)" >> "$GITHUB_OUTPUT"
38+ id : versions
3639 - run : |
3740 {
3841 echo 'tags<<EOF'
39- echo ${{ inputs.dockerTags }} | tr ',' '\n' | sed -e 's/^/type=raw,value=/'
42+ echo ${{ inputs.docker-tags }} | tr ',' '\n' | sed -e 's/^/type=raw,value=/'
4043 echo type=sha
4144 echo EOF
4245 } >> "$GITHUB_OUTPUT"
43- echo "cc-version=$(echo ${{ steps.ghd.outputs.describe }} | cut -c 2-)" >> "$GITHUB_OUTPUT"
4446 id: tag-list
45- - run : sbt -Dproject.version=${{ steps.tag-list.outputs.cc-version }} --batch buildTarballsForDocker
47+ - name : Prepare annotations
48+ run : |
49+ {
50+ echo 'annotations<<EOF'
51+ echo org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ steps.ghd.outputs.sha }}/docker
52+ echo org.opencontainers.image.licenses=MIT
53+ echo org.opencontainers.image.description=Unit Zero Node
54+ echo org.opencontainers.image.base.name=${{ steps.versions.outputs.base-image }}
55+ echo org.opencontainers.image.base.digest=${{ steps.versions.outputs.base-image-digest }}
56+ echo org.opencontainers.image.version=${{ steps.versions.outputs.cc-version }}
57+ echo org.opencontainers.image.revision=${{ steps.ghd.outputs.sha }}
58+ echo EOF
59+ } >> "$GITHUB_OUTPUT"
60+ id : annotations
61+ - uses : actions/setup-java@v4
62+ with :
63+ distribution : ' temurin'
64+ java-version : ' 11'
65+ cache : ' sbt'
66+ - uses : sbt/setup-sbt@v1
67+ - run : sbt -Dproject.version=${{ steps.versions.outputs.cc-version }} --batch buildTarballsForDocker
4668 - uses : docker/login-action@v3
4769 with :
4870 registry : ghcr.io
@@ -52,28 +74,31 @@ jobs:
5274 - uses : docker/metadata-action@v5
5375 id : meta
5476 env :
55- DOCKER_METADATA_ANNOTATIONS_LEVELS : manifest,index
77+ DOCKER_METADATA_ANNOTATIONS_LEVELS : index, manifest-descriptor ,index-descriptor
5678 with :
5779 images : ${{ env.IMAGE_NAME }}
58- flavor : latest=${{ contains(inputs.dockerTags, 'latest') }}
59- tags : |
60- ${{ steps.tag-list.outputs.tags }}
61- labels : |
62- org.opencontainers.image.source=https://github.com/${{ github.repository }}
63- org.opencontainers.image.licenses=MIT
64- org.opencontainers.image.description=Unit Zero Node
80+ flavor : latest=${{ contains(inputs.docker-tags, 'latest') }}
81+ tags : ${{ steps.tag-list.outputs.tags }}
82+ annotations : ${{ steps.annotations.outputs.annotations }}
83+ labels : ${{ steps.annotations.outputs.annotations }}
6584 - uses : docker/build-push-action@v5
6685 id : push
6786 with :
6887 context : ./docker
6988 platforms : linux/amd64,linux/arm64
7089 push : true
7190 pull : true
72- build-args : baseImage=${{ inputs.baseImage }}
91+ build-args : baseImage=${{ steps.versions.outputs.base-image }}@${{ steps.versions.outputs.base-image-digest }}
7392 tags : ${{ steps.meta.outputs.tags }}
7493 annotations : ${{ steps.meta.outputs.annotations }}
7594 labels : ${{ steps.meta.outputs.labels }}
7695 cache-from : type=gha
7796 cache-to : type=gha,mode=max
78- - run : |
79- echo 'Base image: `${{ inputs.baseImage }}`' >> $GITHUB_STEP_SUMMARY
97+ - name : Prepare summary
98+ run : |
99+ {
100+ echo '## Image Info'
101+ echo '- This image: `${{ env.IMAGE_NAME }}@${{ steps.push.outputs.digest }}`'
102+ echo '- Base image: `${{ steps.versions.outputs.base-image }}@${{ steps.versions.outputs.base-image-digest }}`'
103+ echo '- Version: `${{ steps.versions.outputs.cc-version }}`'
104+ } >> $GITHUB_STEP_SUMMARY
0 commit comments