Skip to content

Commit 572935d

Browse files
committed
wip
1 parent 7f3ee5b commit 572935d

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

.github/workflows/publish-docker-image.yml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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'
3942
echo ${{ inputs.dockerTags }} | 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,16 +74,12 @@ 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 }}
5880
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
81+
tags: ${{ steps.tag-list.outputs.tags }}
82+
annotations: ${{ steps.annotations.outputs.annotations }}
6583
- uses: docker/build-push-action@v5
6684
id: push
6785
with:
@@ -75,5 +93,11 @@ jobs:
7593
labels: ${{ steps.meta.outputs.labels }}
7694
cache-from: type=gha
7795
cache-to: type=gha,mode=max
78-
- run: |
79-
echo 'Base image: `${{ inputs.baseImage }}`' >> $GITHUB_STEP_SUMMARY
96+
- name: Prepare summary
97+
run: |
98+
{
99+
echo '## Image Info'
100+
echo '- This image: `${{ env.IMAGE_NAME }}@${{ steps.push.outputs.digest }}`'
101+
echo '- Base image: `${{ steps.versions.outputs.base-image }}@${{ steps.versions.outputs.base-image-digest }}`'
102+
echo '- Version: `${{ steps.versions.outputs.cc-version }}`'
103+
} >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)