58 Zeilen
1,7 KiB
YAML
58 Zeilen
1,7 KiB
YAML
author: Sebastian Tobie
|
|
description: pushes images via skopeo to an target
|
|
name: push images
|
|
|
|
inputs:
|
|
tags:
|
|
required: true
|
|
description: tags that are send to the registry
|
|
registry:
|
|
required: true
|
|
description: "the desired registry, default is the forgejo instance"
|
|
path:
|
|
required: true
|
|
description: "path under the registry for the image"
|
|
image:
|
|
required: true
|
|
description: |
|
|
the image that is copied with the storage.
|
|
Examples:
|
|
|
|
- dir:image
|
|
- container-storage:image:tag
|
|
- docker://registry/path:tag
|
|
username:
|
|
default: USER
|
|
description: "Username in case its important"
|
|
password:
|
|
required: true
|
|
description: "password for authentication"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: login
|
|
shell: sh
|
|
run: |
|
|
if [ -z "${{ inputs.password }}" ] ; then
|
|
echo The password is unset
|
|
exit 1
|
|
fi
|
|
skopeo login -u "${{ inputs.username }}" -p "${{ inputs.password }}" ${{ inputs.registry }}
|
|
env:
|
|
REGISTRY_AUTH_FILE: ${{env.RUNNER_TEMP}}/auth.json
|
|
- name: skopeo copy
|
|
shell: sh
|
|
env:
|
|
REGISTRY_AUTH_FILE: ${{env.RUNNER_TEMP}}/auth.json
|
|
REGISTRY: "${{ inputs.registry }}"
|
|
run: |
|
|
server=${REGISTRY//https:/docker:}
|
|
if [[ "$server" != docker://* ]] ; then
|
|
server="docker://$server"
|
|
fi
|
|
for tag in ${{ inputs.tags }}; do
|
|
name="${server}/${{ inputs.path }}:${tag}"
|
|
printf "pushing image to %s" "$name"
|
|
skopeo copy --dest-compress --dest-compress-format zstd --dest-compress-level 15 -q -a --dest-precompute-digests ${{ inputs.image }} "$name"
|
|
done
|