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

53 Zeilen
1,5 KiB
YAML

2025-02-02 10:47:58 +01:00
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: 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 -q -a --dest-precompute-digests ${{ inputs.image }} "$name"
done