Add docker/push/action.yaml

This commit is contained in:
Zakary Timson 2023-07-28 17:58:51 +00:00
parent 2093548721
commit e7d98a9f50

31
docker/push/action.yaml Normal file
View File

@ -0,0 +1,31 @@
name: Push docker image
inputs:
registry:
required: false
type: string
default: $GITHUB_SERVER_URL
registry_user:
required: false
type: string
default: $GITHUB_ACTOR
registry_pass:
required: true
type: string
image:
required: true
type: string
default: $GITHUB_REPOSITORY
tag:
required: false
type: string
runs:
using: composite
steps:
- name: Push image
run: |
TAG=$([ -n "${{inputs.tag}}" ] && echo "${{inputs.tag}}" || [ "$GITHUB_REF" == "refs/heads/develop" ] && echo "latest" || echo "$GITHUB_REF_NAME" | sed -E "s/[_/]/-/g")
echo "${{inputs.registry_pass}}" | docker login -u "${{inputs.registry_user}}" --password-stdin "${{inputs.registry}}"
docker push "${{inputs.image}}:$TAG"