packagebuild/.forgejo/steps/push/action.yml

55 Zeilen
1,6 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: |
skopeo login -u ${{ inputs.username }} -p ${{ inputs.password }} ${{ inputs.registry }}
env:
REGISTRY_AUTH_FILE: ${{env.RUNNER_TEMP}}/auth.json
- name: skopeo copy
shell: bash
env:
REGISTRY_AUTH_FILE: ${{env.RUNNER_TEMP}}/auth.json
REGISTRY: ${{ inputs.registry }}
run: |
set -x
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