Skip to content

Commit 04fbe4b

Browse files
author
Dieter Baier
committed
Some metatags added
1 parent 0da9045 commit 04fbe4b

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/create-docs-toolbox-image.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,43 @@ jobs:
5555
5656
echo "Using tags: ${TAGS}"
5757
58+
- name: Extract description from README
59+
id: readme
60+
shell: bash
61+
run: |
62+
set -euo pipefail
63+
64+
if [[ ! -f README.md ]]; then
65+
echo "description=A lightweight Docker image for running Docs-as-Code pipelines in a fully reproducible environment — locally and in CI." >> "$GITHUB_OUTPUT"
66+
exit 0
67+
fi
68+
69+
DESC="$(
70+
awk '
71+
/^# / { found_title=1; next }
72+
found_title && NF { print; exit }
73+
' README.md
74+
)"
75+
76+
if [[ -z "${DESC}" ]]; then
77+
DESC="A lightweight Docker image for running Docs-as-Code pipelines in a fully reproducible environment — locally and in CI."
78+
fi
79+
80+
# Markdown-Links grob entschärfen: [text](url) -> text
81+
DESC="$(printf '%s' "$DESC" | sed -E 's/\[([^\]]+)\]\([^)]+\)/\1/g')"
82+
83+
# Quotes und Backslashes entschärfen
84+
DESC="$(printf '%s' "$DESC" | sed 's/\\/\\\\/g; s/"/\\"/g')"
85+
86+
# Auf eine Zeile reduzieren
87+
DESC="$(printf '%s' "$DESC" | tr '\n' ' ' | sed -E 's/[[:space:]]+/ /g; s/^ //; s/ $//')"
88+
89+
# GitHub Container Registry limit: 512 chars max für description
90+
DESC="$(printf '%.512s' "$DESC")"
91+
92+
echo "description=${DESC}" >> "$GITHUB_OUTPUT"
93+
echo "Description: ${DESC}"
94+
5895
- name: Login to GHCR
5996
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
6097

@@ -71,6 +108,7 @@ jobs:
71108
72109
IMAGE="${{ steps.image.outputs.image_name }}"
73110
TAGS="${{ steps.meta.outputs.tags }}"
111+
DESCRIPTION="${{ steps.readme.outputs.description }}"
74112
75113
TAG_ARGS=""
76114
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"
@@ -83,12 +121,15 @@ jobs:
83121
--cache-from=type=registry,ref=$IMAGE:cache \
84122
--cache-to=type=registry,ref=$IMAGE:cache,mode=max \
85123
$TAG_ARGS \
124+
--annotation "index:org.opencontainers.image.description=$DESCRIPTION" \
125+
--annotation "index:org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
86126
--push .
87127
88128
- name: Print summary
89129
shell: bash
90130
run: |
91131
echo "Dockerfile hash tag: ${{ steps.meta.outputs.hash_tag }}"
132+
echo "Description: ${{ steps.readme.outputs.description }}"
92133
if [[ "${{ steps.meta.outputs.has_git_tag }}" == "true" ]]; then
93134
echo "Git tag: ${{ steps.meta.outputs.git_tag }}"
94135
echo "latest tag was also published"

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
LABEL org.opencontainers.image.title="docs-toolbox" \
2+
org.opencontainers.image.description="A lightweight Docker image for running Docs-as-Code pipelines in a fully reproducible environment — locally and in CI." \
3+
org.opencontainers.image.source="https://github.com/dieterbaier/docs-toolbox" \
4+
org.opencontainers.image.licenses="MIT"
15
# ---------------------------
26
# Base Image: Java + Tools
37
# ---------------------------

0 commit comments

Comments
 (0)