Skip to content

Commit

Permalink
ci: fix docker labels
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Oct 30, 2023
1 parent 452f59f commit 867e0be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ jobs:

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v5
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.package-name }}
tag-sha: true
tags: |
type=sha
labels: |
org.opencontainers.image.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you."
org.opencontainers.image.title="MonicaHQ, the Personal Relationship Manager"
org.opencontainers.image.vendor="Monica"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -50,6 +55,10 @@ jobs:
- name: Configure variables
run: scripts/docker/build.sh --skip-build $GITHUB_SHA

- name: Fix labels
id: labels
run: scripts/ci/labels.sh labels "${{ steps.docker_meta.outputs.labels }}"

# Build docker
- name: Docker build
id: docker_build
Expand All @@ -62,6 +71,7 @@ jobs:
file: scripts/docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
outputs: ${{ steps.labels.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Expand Down
15 changes: 15 additions & 0 deletions scripts/ci/labels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -ex

IFS='
'
variable=$1
labels=$2

{
echo "$variable<<EOF"
for label in $labels; do
echo type=image,name=target,annotation-index.$label
done
echo 'EOF'
} >> "$GITHUB_OUTPUT"

0 comments on commit 867e0be

Please sign in to comment.