# 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 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 } frontend::release() { frontend::assert_exists 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}" git describe --tags popd }