fix registry authentication
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Podman Build And Publish Action
|
# Podman Build And Publish Action
|
||||||
|
|
||||||
Composite action that builds and optionally pushes OCI images with Podman to `registry.noctrl.eu`.
|
Composite action that builds and pushes OCI images with Podman to `registry.noctrl.eu`.
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
@@ -9,11 +9,12 @@ Composite action that builds and optionally pushes OCI images with Podman to `re
|
|||||||
- `context` (optional, default `.`): build context
|
- `context` (optional, default `.`): build context
|
||||||
- `containerfile` (optional, default `Containerfile`): containerfile path
|
- `containerfile` (optional, default `Containerfile`): containerfile path
|
||||||
- `build-args` (optional): newline-separated `KEY=VALUE`
|
- `build-args` (optional): newline-separated `KEY=VALUE`
|
||||||
- `push` (optional, default `true`): whether to push image tags
|
- `registry-username` (required): registry login username
|
||||||
|
- `registry-password` (required): registry login password
|
||||||
|
|
||||||
## Required Secrets
|
## Caller Secrets
|
||||||
|
|
||||||
The following repository secrets must be defined to push images:
|
Define these secrets in the calling repository and pass them to the action inputs:
|
||||||
- `REGISTRY_USERNAME`: registry authentication username
|
- `REGISTRY_USERNAME`: registry authentication username
|
||||||
- `REGISTRY_PASSWORD`: registry authentication password
|
- `REGISTRY_PASSWORD`: registry authentication password
|
||||||
|
|
||||||
@@ -45,7 +46,8 @@ jobs:
|
|||||||
containerfile: Containerfile
|
containerfile: Containerfile
|
||||||
build-args: |
|
build-args: |
|
||||||
ACT_RUNNER_VERSION=0.2.11
|
ACT_RUNNER_VERSION=0.2.11
|
||||||
push: "true"
|
registry-username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note:** The action accesses `${{ secrets.REGISTRY_USERNAME }}` and `${{ secrets.REGISTRY_PASSWORD }}` from the calling repository's secrets context. These must be defined in the caller's repository settings.
|
> **Note:** Composite actions should receive credentials through inputs. Keep secrets in the caller repo and pass them via `with:` as shown above.
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ inputs:
|
|||||||
Tags to apply and push. Supports newline, comma, or space separated values.
|
Tags to apply and push. Supports newline, comma, or space separated values.
|
||||||
Example: "latest\nsha-abc123"
|
Example: "latest\nsha-abc123"
|
||||||
required: true
|
required: true
|
||||||
|
registry-username:
|
||||||
|
description: Registry username for login.
|
||||||
|
required: true
|
||||||
|
registry-password:
|
||||||
|
description: Registry password for login.
|
||||||
|
required: true
|
||||||
context:
|
context:
|
||||||
description: Build context path.
|
description: Build context path.
|
||||||
required: false
|
required: false
|
||||||
@@ -24,10 +30,6 @@ inputs:
|
|||||||
Example: "ACT_RUNNER_VERSION=0.2.11"
|
Example: "ACT_RUNNER_VERSION=0.2.11"
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
push:
|
|
||||||
description: Push image tags after build.
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -70,7 +72,6 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ -n "${{ secrets.REGISTRY_USERNAME }}" && -n "${{ secrets.REGISTRY_PASSWORD }}" ]]; then
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${PODMAN_ROOT}"
|
--root "${PODMAN_ROOT}"
|
||||||
--runroot "${PODMAN_RUNROOT}"
|
--runroot "${PODMAN_RUNROOT}"
|
||||||
@@ -78,10 +79,7 @@ runs:
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo "Logging in to registry: registry.noctrl.eu"
|
echo "Logging in to registry: registry.noctrl.eu"
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
echo "${{ inputs.registry-password }}" | podman "${podman_args[@]}" login registry.noctrl.eu -u "${{ inputs.registry-username }}" --password-stdin
|
||||||
else
|
|
||||||
echo "Registry credentials not available (REGISTRY_USERNAME and REGISTRY_PASSWORD secrets required for push)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- id: build
|
- id: build
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -118,11 +116,6 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ "${{ inputs.push }}" != "true" ]]; then
|
|
||||||
echo "Push disabled by input push=${{ inputs.push }}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
podman_args=(
|
podman_args=(
|
||||||
--root "${PODMAN_ROOT}"
|
--root "${PODMAN_ROOT}"
|
||||||
--runroot "${PODMAN_RUNROOT}"
|
--runroot "${PODMAN_RUNROOT}"
|
||||||
|
|||||||
Reference in New Issue
Block a user