commit 99706e422218f0311fe230985d2e33ffb2c7ac44 Author: Quentin Campos Date: Wed Jun 3 11:57:44 2026 +0200 initial commit diff --git a/setup-kaniko/action.yaml b/setup-kaniko/action.yaml new file mode 100644 index 0000000..e479692 --- /dev/null +++ b/setup-kaniko/action.yaml @@ -0,0 +1,34 @@ +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 }}"