Files
registry-login/action.yaml
2025-04-14 14:07:51 +02:00

61 lines
1.8 KiB
YAML

name: 'Connect to a docker registry'
description: 'Connection to a docker registry using podman or docker'
author: 'Eric Coissac'
inputs:
registry_command:
description: 'command used to realise the login'
required: false
default: 'podman'
registry_server:
description: 'Address of the image registry server'
required: false
default: "niepce.petite-maison-orange.fr"
registry_user:
description: 'User used for the connection to the image registry'
required: false
default: ${{ secrets.PMO_REGISTRY_USER }}
registry_password:
description: 'Password used for the connection to the image registry'
required: false
default: ${{ secrets.PMO_REGISTRY_PASSWORD }}
debug:
description: 'Run the action in debug mode'
required: false
default: false
type: boolean
runs:
using: 'composite'
steps:
- name: Load bash library
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/bash-library@main
- name: Set debug mode
if: ${{ inputs.debug == 'true' }}
shell: bash
run: |
source "${{ github.action_path }}/../bashlib.sh"
export DEBUG="ON"
echo "DEBUG=ON" >> $GITEA_ENV
debug Debug switch on
- name: Podman connection to the registry
shell: bash
run: |
source "${{ github.action_path }}/../bashlib.sh"
check_command ${{ inputs.registry_command }}
step "${{ inputs.registry_command }} connection to registry" "${{ inputs.registry_server }}..."
if result=$(${{ inputs.registry_command }} login ${{ inputs.registry_server }} \
-u ${{ inputs.registry_user }} \
-p ${{ inputs.registry_password }})
then
success "${result}"
else
error "Error" "${result}"
fi