Simplify auto-tag functionality for now
ci/woodpecker/push/build_and_release Pipeline was successful
Details
ci/woodpecker/push/build_and_release Pipeline was successful
Details
This commit is contained in:
parent
8a78141886
commit
ce3c29ef57
26
plugin.sh
26
plugin.sh
|
@ -58,31 +58,19 @@ if [ -n "${PLUGIN_BUILD_ARGS_FROM_ENV:-}" ]; then
|
|||
BUILD_ARGS_FROM_ENV=$(echo "${PLUGIN_BUILD_ARGS_FROM_ENV}" | tr ',' '\n' | while read build_arg; do echo "--build-arg ${build_arg}=$(eval "echo \$$build_arg")"; done)
|
||||
fi
|
||||
|
||||
# TODO: Test auto_tag behavior; potential bugs might still be here
|
||||
# auto_tag, if set auto_tag: true, auto generate .tags file
|
||||
# support format Major.Minor.Release or start with `v`
|
||||
# docker tags: Major, Major.Minor, Major.Minor.Release and latest
|
||||
# Simply auto-tagging
|
||||
if [[ "${PLUGIN_AUTO_TAG:-}" == "true" ]]; then
|
||||
|
||||
if [[ -n "${PLUGIN_TAG_STRIP_V:-}" ]]; then
|
||||
TAG=$(echo "${CI_COMMIT_TAG:-}" | sed 's/^v//g')
|
||||
tag_part_count=$(echo "${TAG}" | tr '.' '\n' | wc -l)
|
||||
tag_field=${PLUGIN_:-major}
|
||||
# expect number
|
||||
echo ${TAG} | grep -E "[a-z-]" &>/dev/null && tag_contains_letter=1 || tag_contains_letter=0
|
||||
else
|
||||
TAG="${CI_COMMIT_TAG}"
|
||||
fi
|
||||
|
||||
if [ ! -n "${TAG:-}" ]; then
|
||||
echo "latest" > .tags
|
||||
elif [ ${tag_contains_letter} -eq 1 -o ${tag_part_count} -gt 3 ]; then
|
||||
echo "${TAG},latest" > .tags
|
||||
else
|
||||
major=$(echo "${TAG}" | awk -F'.' '{print $1}')
|
||||
minor=$(echo "${TAG}" | awk -F'.' '{print $2}')
|
||||
release=$(echo "${TAG}" | awk -F'.' '{print $3}')
|
||||
|
||||
major=${major:-0}
|
||||
minor=${minor:-0}
|
||||
release=${release:-0}
|
||||
|
||||
echo "${major},${major}.${minor},${major}.${minor}.${release},latest" > .tags
|
||||
echo "${TAG},latest" > .tags
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue