#!/bin/sh # Gitea 1.27 does not populate ref_protected. Repository administrators opt in # after configuring branch/tag protection and package credentials in Gitea. set -eu publish=false if [ "${PUBLISH_IMAGES:-}" = true ]; then case "${GITHUB_EVENT_NAME:-}" in push|workflow_dispatch) case "${GITHUB_REF_TYPE:-}" in branch) if [ -n "${DEFAULT_BRANCH:-}" ] && [ "${GITHUB_REF_NAME:-}" = "$DEFAULT_BRANCH" ]; then publish=true fi ;; tag) case "${GITHUB_REF_NAME:-}" in ''|*[!v0-9.]*) ;; *) if printf '%s\n' "$GITHUB_REF_NAME" | grep -Eq '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'; then publish=true fi ;; esac ;; esac ;; esac fi printf '%s\n' "$publish"