actions/docker/push/action.yaml

52 lines
1.4 KiB
YAML
Raw Normal View History

2024-02-06 08:51:33 -05:00
name: Docker Push
description: Push Image to Registry
inputs:
2024-02-06 09:11:02 -05:00
from:
type: string
required: false
description: Re-tag an existing image
default: false
2024-02-06 08:51:33 -05:00
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}}
runs:
using: composite
steps:
- name: Format Registry URL
2024-02-06 09:36:53 -05:00
run: |
echo "URL=$(echo ${{github.server_url}} | sed s%http://%% | sed s%https://%% )" >> $GITHUB_ENV
echo "FROM=$(echo "${{inputs.from}}" | sed s%http://%% | sed s%https://%% )" >> $GITHUB_ENV
2024-02-06 08:51:33 -05:00
shell: sh
2024-02-06 09:06:27 -05:00
- name: Tag Image
run: |
2024-02-06 09:36:53 -05:00
[[ "${{env.FROM}}" == "false" ]] && echo "Skipping..." || docker tag "${{env.FROM}}" "${{env.URL}}/${{inputs.name}}:${{inputs.tag}}"
2024-02-06 08:51:33 -05:00
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}}"