1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-15 03:37:17 +00:00
test-tutorial-framework/hack/libhack/frontend.sh

35 lines
906 B
Bash
Raw Normal View History

2019-09-30 13:08:04 +00:00
# Requires context:
# - FRONTEND_PATH: absolute path of frontend repo
FRONTEND_IMAGE_NAME="${FRONTEND_IMAGE_NAME:-avatao/frontend-tutorial-framework}"
libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "${libhack_dir}/common.sh"
frontend::assert_exists() {
if [[ ! -d "${FRONTEND_PATH}" ]]; then
exit 0
fi
}
frontend::build() {
pushd "${FRONTEND_PATH}"
docker build -t "${FRONTEND_IMAGE_NAME}:$(releasename)" .
popd
}
frontend::release() {
pushd "${FRONTEND_PATH}"
local tag
tag="$(releasename)"
read -p "Tag and push frontend \"${tag}\"? [y/N]" -r && echo
if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]; then
printf "Pushing git tag to upstream...\n"
tag="${tag}" description="${tag}" force_push_tag
printf "\nPushing image to DockerHub...\n"
docker push "${FRONTEND_IMAGE_NAME}:${tag}"
fi
popd
}