Compare commits

...

3 commits
v1.1 ... master

Author SHA1 Message Date
243b799457 Add latest tag too 2025-07-19 13:42:23 +03:00
3c7f3e5cd4 rename var 2025-07-19 13:14:17 +03:00
bee1136fd4 fix getting git tag 2025-07-19 13:12:54 +03:00

View file

@ -3,12 +3,12 @@ script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
repo="$(basename "${script_dir}")"
tag="${1}"
if [ -z "${tag}" ]; then
git_reference=$(grep '^ref: ' .git/HEAD | awk 'BEGIN {FS="/"} {print($NF)}')
if [ "${git_reference}" == 'master' ] || [ "${git_reference}" == 'main' ] || [ -z "${git_reference}" ]; then
git_tag=$(git describe --exact-match --tags)
if [ "${git_tag}" == 'master' ] || [ "${git_tag}" == 'main' ] || [ -z "${git_tag}" ]; then
echo "Change to a different git reference not 'master/main', since it will be used as tag for the container. Or pass a tag name as only parameter."
exit 1
fi
tag="${git_reference}"
tag="${git_tag}"
fi
echo "Building '${repo}:${tag}'..."
podman build --tag "${repo}:${tag}" .
@ -16,3 +16,10 @@ echo "Tagging it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..."
podman tag "${repo}:${tag}" "repos.susurrando.com/adelgado/${repo}:${tag}"
echo "Pushing it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..."
podman push "repos.susurrando.com/adelgado/${repo}:${tag}"
tag=latest
echo "Building '${repo}:${tag}'..."
podman build --tag "${repo}:${tag}" .
echo "Tagging it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..."
podman tag "${repo}:${tag}" "repos.susurrando.com/adelgado/${repo}:${tag}"
echo "Pushing it to 'repos.susurrando.com/adelgado/${repo}:${tag}'..."
podman push "repos.susurrando.com/adelgado/${repo}:${tag}"