mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 02:37:17 +00:00
35 lines
906 B
Bash
35 lines
906 B
Bash
|
# 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
|
||
|
}
|