Skip to content

Commit 84822d7

Browse files
committed
ci: fix GHCR package description, add OCI index annotations
GHCR reads the package description from OCI index-level annotations, not image config labels. With buildx the pushed artifact is an image index, so labels alone never surfaced on the package page. - Add `annotations` output to set description at the index level (docker/build-push-action `annotations` input, supported in v7) - Move the dynamic commit list from org.opencontainers.image.description to a custom com.chatmail.changes label -- the old multiline value broke the labels format (each line parsed as a separate key=value) and exceeded GHCR's 512 char text-only limit - Use a static description for the OCI standard label - Add org.opencontainers.image.licenses to Dockerfile
1 parent 1598d70 commit 84822d7

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

.github/workflows/docker-ci.yaml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ jobs:
125125
echo "${TAGS}" >> "$GITHUB_OUTPUT"
126126
echo "EOF" >> "$GITHUB_OUTPUT"
127127
128-
# -- Description: commit list since last image --
128+
# -- Changes: commit list since last image (stored in custom label) --
129129
BASE_SHA=""
130130
if [ "${RELAY_REF}" = "main" ]; then
131-
# Previous :main image's relay SHA from its sha-XXXXXXX tag
132131
BASE_SHA=$(gh api "orgs/chatmail/packages/container/docker/versions?per_page=50" \
133132
--jq '[.[]
134133
| select(.metadata.container.tags | any(. == "main"))
@@ -137,17 +136,18 @@ jobs:
137136
else
138137
BASE_SHA=$(gh api "repos/chatmail/relay/commits/main" --jq '.sha[:7]' 2>/dev/null) || true
139138
fi
140-
COMMITS=""
139+
CHANGES=""
141140
if [ -n "$BASE_SHA" ] && [ "$BASE_SHA" != "$RELAY_SHA_SHORT" ]; then
142-
COMMITS=$(gh api "repos/chatmail/relay/compare/${BASE_SHA}...${RELAY_SHA}" \
143-
--jq '.commits[] | "- " + .sha[:7] + " " + (.commit.message | split("\n")[0])' 2>/dev/null) || true
141+
CHANGES=$(gh api "repos/chatmail/relay/compare/${BASE_SHA}...${RELAY_SHA}" \
142+
--jq '.commits[] | .sha[:7] + " " + (.commit.message | split("\n")[0])' 2>/dev/null) || true
144143
fi
145-
if [ -n "$COMMITS" ]; then
146-
COUNT=$(echo "$COMMITS" | wc -l)
147-
DESC="relay/${RELAY_REF} (${COUNT} commits since sha-${BASE_SHA}):"$'\n'"${COMMITS}"
148-
else
149-
DESC="relay/${RELAY_REF}: ${COMMIT_MSG}"
144+
if [ -z "$CHANGES" ]; then
145+
CHANGES="${RELAY_SHA_SHORT} ${COMMIT_MSG}"
150146
fi
147+
148+
# Static description for GHCR package page (512 char limit, text-only)
149+
DESC="Chatmail Relay Server"
150+
151151
{
152152
echo "labels<<EOF"
153153
echo "org.opencontainers.image.title=chatmail-relay"
@@ -156,6 +156,15 @@ jobs:
156156
echo "org.opencontainers.image.source=https://github.com/chatmail/relay"
157157
echo "org.opencontainers.image.created=${BUILD_DATE}"
158158
echo "com.chatmail.source.ref=${RELAY_REF}"
159+
echo "com.chatmail.changes=${CHANGES}"
160+
echo "EOF"
161+
} >> "$GITHUB_OUTPUT"
162+
163+
# Index-level annotations so GHCR picks up the description
164+
{
165+
echo "annotations<<EOF"
166+
echo "org.opencontainers.image.title=chatmail-relay"
167+
echo "org.opencontainers.image.description=${DESC}"
159168
echo "EOF"
160169
} >> "$GITHUB_OUTPUT"
161170
@@ -170,6 +179,7 @@ jobs:
170179
push: ${{ github.event_name != 'pull_request' }}
171180
tags: ${{ steps.meta.outputs.tags }}
172181
labels: ${{ steps.meta.outputs.labels }}
182+
annotations: ${{ steps.meta.outputs.annotations }}
173183
cache-from: type=gha
174184
cache-to: type=gha,mode=max
175185
build-args: |

chatmail_relay.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ ARG SOURCE_URL="https://github.com/chatmail/relay.git"
7676
ARG BUILD_DATE=""
7777

7878
LABEL org.opencontainers.image.title="chatmail-relay"
79-
LABEL org.opencontainers.image.description="Chatmail relay server - optimized email for Delta Chat"
79+
LABEL org.opencontainers.image.description="Chatmail Relay Server"
80+
LABEL org.opencontainers.image.licenses="MIT"
8081
LABEL org.opencontainers.image.revision=$GIT_HASH
8182
LABEL org.opencontainers.image.source=$SOURCE_URL
8283
LABEL org.opencontainers.image.created=$BUILD_DATE

0 commit comments

Comments
 (0)