87 lines
2.8 KiB
YAML
87 lines
2.8 KiB
YAML
name: Docker Create image manifest
|
|
description: Build and push Docker images with Buildx
|
|
author: zertus
|
|
branding:
|
|
icon: 'anchor'
|
|
color: 'blue'
|
|
inputs:
|
|
oci-registry:
|
|
description: "OCI registry where to pull and push images"
|
|
required: true
|
|
oci-registry-username:
|
|
description: |
|
|
Username used to log against the OCI registry.
|
|
See https://github.com/docker/login-action#usage.
|
|
required: true
|
|
oci-registry-password:
|
|
description: |
|
|
Password or personal access token used to log against the OCI registry.
|
|
Can be passed in using `secrets.GITHUB_TOKEN`.
|
|
See https://github.com/docker/login-action#usage.
|
|
required: true
|
|
repository:
|
|
description: |
|
|
Repository name.
|
|
Example: `my-org/my-repo`.
|
|
See [Docker get-image-metadata action](../get-image-metadata/README.md).
|
|
default: ${{ github.repository }}
|
|
required: false
|
|
image:
|
|
description: |
|
|
Additional image name.
|
|
Example: `application`.
|
|
See [Docker get-image-metadata action](../get-image-metadata/README.md).
|
|
required: false
|
|
tag:
|
|
description: "Image tag to publish"
|
|
required: false
|
|
digests:
|
|
description: |
|
|
Comma-separated list of image digests to include in the manifest list.
|
|
Example: `sha256:abc123...,sha256:def456...`.
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- id: get-image-name
|
|
shell: bash
|
|
run: |
|
|
IMAGE_NAME="${{ inputs.repository }}"
|
|
|
|
if [ -n "${{ inputs.image }}" ]; then
|
|
IMAGE_NAME="${IMAGE_NAME}/${{ inputs.image }}"
|
|
fi
|
|
|
|
IMAGE_NAME="${{ inputs.oci-registry }}/${IMAGE_NAME}"
|
|
|
|
echo "image-name=$IMAGE_NAME" >> "$GITHUB_OUTPUT"
|
|
|
|
if [ -n "${{ inputs.tag }}" ]; then
|
|
IMAGE_NAME="${IMAGE_NAME}:${{ inputs.tag }}"
|
|
fi
|
|
|
|
echo "fully-qualified-image-name=$IMAGE_NAME" >> "$GITHUB_OUTPUT"
|
|
- uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
|
with:
|
|
registry: ${{ inputs.oci-registry }}
|
|
username: ${{ inputs.oci-registry-username }}
|
|
password: ${{ inputs.oci-registry-password }}
|
|
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
|
id: setup-buildx
|
|
with:
|
|
version: v0.30.1
|
|
driver-opts: |
|
|
image=moby/buildkit:v0.26.3
|
|
- id: create-image-manifest
|
|
shell: bash
|
|
run: |
|
|
BASE_IMAGE="${{ steps.get-image-name.outputs.image-name }}"
|
|
|
|
SOURCES=""
|
|
IFS=',' read -ra ADDR <<< "${{ inputs.digests }}"
|
|
for digest in "${ADDR[@]}"; do
|
|
digest=$(echo "$digest" | xargs)
|
|
SOURCES="$SOURCES ${BASE_IMAGE}@${digest}"
|
|
done
|
|
|
|
docker buildx imagetools create -t "${{ steps.get-image-name.outputs.fully-qualified-image-name }}" $SOURCES |