actions/docker/build/action.yaml

25 lines
623 B
YAML

name: Build docker image
inputs:
registry:
required: false
type: string
default: $GITHUB_SERVER_URL
image:
required: true
type: string
default: $GITHUB_REPOSITORY
tag:
required: false
type: string
runs:
using: composite
steps:
- name: Build image
run: |
TAG=$([ -n "${{inputs.tag}}" ] && echo "${{inputs.tag}}" || [ "$GITHUB_REF" == "refs/heads/develop" ] && echo "latest" || echo "$GITHUB_REF_NAME" | sed -E "s/[_/]/-/g")
REG=$(echo "${{inputs.registry}}" | sed -E "s%https?://%%gi")
docker build --no-cache -t "$REG/${{inputs.image}}:$TAG" .