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

45 lines
1.1 KiB
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::build() {
frontend::assert_exists
2019-09-30 13:08:04 +00:00
pushd "${FRONTEND_PATH}"
docker build -t "${FRONTEND_IMAGE_NAME}:$(releasename)" .
popd
}
frontend::assert_exists() {
if [[ ! -d "${FRONTEND_PATH}" ]]; then
printf "Cannot find frontend at ${FRONTEND_PATH}!\n"
exit 1
fi
}
2019-09-30 13:08:04 +00:00
frontend::release() {
frontend::assert_exists
2019-09-30 13:08:04 +00:00
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
}
frontend::latest_tag() {
frontend::assert_exists
pushd "${FRONTEND_PATH}"
2019-11-07 15:30:54 +00:00
git describe --abbrev=0
popd
}