Files
registry-login/action.yaml

45 lines
1.5 KiB
YAML
Raw Normal View History

2025-04-14 08:41:32 +02:00
name: 'Connect to a docker registry'
2025-04-14 09:05:27 +02:00
description: 'Connection to a docker registry using podman or docker'
2025-04-14 08:29:20 +02:00
author: 'Eric Coissac'
inputs:
2025-04-14 09:05:27 +02:00
registry_command:
description: 'command used to realise the login'
required: false
default: 'podman'
2025-04-14 08:41:32 +02:00
registry_server:
description: 'Address of the image registry server'
2025-04-14 08:29:20 +02:00
required: false
2025-04-14 08:41:32 +02:00
default: "niepce.petite-maison-orange.fr"
registry_user:
description: 'User used for the connection to the image registry'
2025-04-14 08:29:20 +02:00
required: false
2025-04-14 08:41:32 +02:00
default: ${{ secrets.PMO_REGISTRY_USER }}
registry_password:
description: 'Password used for the connection to the image registry'
required: false
default: ${{ secrets.PMO_REGISTRY_PASSWORD }}
2025-04-14 08:29:20 +02:00
runs:
using: 'composite'
steps:
2025-04-14 08:41:32 +02:00
- name: Podman connection to the registry
2025-04-14 08:29:20 +02:00
shell: bash
run: |
2025-04-14 09:05:27 +02:00
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
if [[ -z $(which ${{ inputs.registry_command }}) ]] ; then
echo -e "${RED}❌ Error:${NC}: Cannot locate the ${{ inputs.registry_command }} command"
echo "${{ inputs.registry_command }} connection to registry: ${{ inputs.registry_server }}..."
result=$(${{ inputs.registry_command }} login ${{ inputs.registry_server }} \
2025-04-14 08:41:32 +02:00
-u ${{ inputs.registry_user }} \
2025-04-14 09:05:27 +02:00
-p ${{ inputs.registry_password }}) \
&& echo -e "${GREEN}✅ $result:${NC}" \
|| echo -e "${RED}❌ Error:${NC}"
2025-04-14 08:29:20 +02:00