Skip to content

Commit

Permalink
ci: Extract description from Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
pythoninthegrass committed Oct 10, 2024
1 parent 58ad6af commit a48a432
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract description from Dockerfile
id: dockerfile_description
run: |
DESCRIPTION=$(grep "LABEL org.opencontainers.image.description" ${{ matrix.dockerfile }} | cut -d'"' -f2 || echo "")
if [ -z "$DESCRIPTION" ]; then
DESCRIPTION="No description provided"
echo "Warning: No description found in Dockerfile. Using default." >&2
fi
echo "DESCRIPTION=$DESCRIPTION" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -93,3 +103,5 @@ jobs:
platforms: linux/amd64,linux/arm64/v8
cache-from: type=registry,ref=${{ steps.meta.outputs.tags }}
cache-to: type=registry,ref=${{ steps.meta.outputs.tags }},mode=max
annotations: |
org.opencontainers.image.description=${{ steps.dockerfile_description.outputs.DESCRIPTION }}

0 comments on commit a48a432

Please sign in to comment.