34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
name: 'Setup Kaniko'
|
|
description: 'Configures Docker credentials for Kaniko in Forgejo Actions'
|
|
inputs:
|
|
registry:
|
|
description: 'The container registry to authenticate with'
|
|
required: false
|
|
default: 'git.qcampos.fr'
|
|
username:
|
|
description: 'Username for the registry'
|
|
required: false
|
|
default: '${{ github.actor }}'
|
|
password:
|
|
description: 'Password/Token for the registry'
|
|
required: false
|
|
default: '${{ github.token }}'
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Create Docker Config
|
|
shell: bash
|
|
run: |
|
|
WORKSPACE_PATH="${{ github.workspace }}"
|
|
mkdir -p "$WORKSPACE_PATH/.docker"
|
|
|
|
# Generate the auth string (username:password in base64)
|
|
AUTH_STRING=$(printf '%s:%s' "${{ inputs.username }}" "${{ inputs.password }}" | base64 | tr -d '\n')
|
|
|
|
# Write the config.json file
|
|
printf '{"auths":{"%s":{"auth":"%s"}}}' "${{ inputs.registry }}" "$AUTH_STRING" > "$WORKSPACE_PATH/.docker/config.json"
|
|
|
|
# Export DOCKER_CONFIG for subsequent steps
|
|
echo "DOCKER_CONFIG=$WORKSPACE_PATH/.docker" >> $GITHUB_ENV
|
|
|
|
echo "Successfully configured Kaniko authentication for ${{ inputs.registry }}"
|