35 lines
1.3 KiB
YAML
35 lines
1.3 KiB
YAML
name: Push Container Images
|
|
inputs:
|
|
image-prefix:
|
|
description: Image name prefix to identify images to push.
|
|
required: true
|
|
registry-user:
|
|
description: Username for registry authentication.
|
|
required: true
|
|
registry-token:
|
|
description: Token/password for registry authentication.
|
|
required: true
|
|
registry-endpoint:
|
|
description: Registry endpoint to authenticate with and push to.
|
|
required: true
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Login to Registry
|
|
run: podman login -u ${{ inputs.registry-user }} -p ${{ inputs.registry-token }} ${{ inputs.registry-endpoint }}
|
|
- name: Set image metadata
|
|
id: image-metadata
|
|
run: |
|
|
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
- name: Push tagged images to registry
|
|
run: |
|
|
for image in $(podman image ls --format {{.Repository}} | grep localhost/${{ inputs.image-prefix }})
|
|
do
|
|
for tag in latest ${{ steps.image-metadata.outputs.image-tag }} ${{ github.ref_name }}
|
|
do
|
|
SRC=$image:latest
|
|
DEST=${{ inputs.registry-endpoint }}/$image:$tag
|
|
echo "Pushing $SRC to $DEST"
|
|
podman push $SRC $DEST
|
|
done
|
|
done
|