actions/docker/push/action.yaml

49 lines
1.2 KiB
YAML

name: Docker Push
description: Push Image to Registry
inputs:
registry:
type: string
required: false
description: Docker registry FQDN
default: ${{github.server_url}}
user:
type: string
required: false
description: Docker user
default: ${{github.repository_owner}}
pass:
type: string
required: false
description: User password
default: ${{secrets.DEPLOY_TOKEN}}
name:
type: string
required: false
default: ${{github.repository}}
tag:
type: string
required: false
default: ${{github.ref_name}}
from:
type: string
required: false
description: Re-tag an existing image
default:
runs:
using: composite
steps:
- name: Format Registry URL
run: echo "URL=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )" >> $GITHUB_ENV
shell: sh
- name: Re-Tag
run: [ -n ${{inputs.from}} ] && docker tag ${{inputs.from}} "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}"
shell: sh
- name: Docker Login
uses: docker://docker
with:
args: /bin/sh -c "docker login -u ${{inputs.user}} -p ${{inputs.pass}} ${{env.URL}} && docker push ${{env.URL}}/${{inputs.name}}:${{inputs.tag}}"