36 lines
1 KiB
Bash
Executable file
36 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
image_name="babashka/babashka"
|
|
image_tag=$(cat resources/BABASHKA_VERSION)
|
|
latest_tag="latest"
|
|
|
|
if [[ $image_tag =~ SNAPSHOT$ ]]
|
|
then
|
|
echo "This is a snapshot version"
|
|
snapshot="true"
|
|
else
|
|
echo "This is a non-snapshot version"
|
|
snapshot="false"
|
|
fi
|
|
|
|
if [ -z "$GITHUB_HEAD_REF" ] && [ "${GITHUB_REF##*/}" = "master" ]
|
|
then
|
|
echo "Building Docker image $image_name:$image_tag"
|
|
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin
|
|
docker build -t "$image_name" --build-arg BABASHKA_XMX="-J-Xmx6300m" .
|
|
docker tag "$image_name:$latest_tag" "$image_name:$image_tag"
|
|
# we only update latest when it's not a SNAPSHOT version
|
|
if [ "false" = "$snapshot" ]; then
|
|
echo "Pushing image $image_name:$latest_tag"
|
|
docker push "$image_name:$latest_tag"
|
|
fi
|
|
# we update the version tag, even if it's a SNAPSHOT version
|
|
echo "Pushing image $image_name:$image_tag"
|
|
docker push "$image_name:$image_tag"
|
|
else
|
|
echo "Not publishing Docker image"
|
|
fi
|
|
|
|
exit 0;
|