diff options
Diffstat (limited to 'scripts/deploy.sh')
-rwxr-xr-x | scripts/deploy.sh | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 3f654266..90e48a48 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -19,7 +19,9 @@ usage() echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware" echo -e "\tclean - delete created docker image for IronOS & its build cache objects\n" echo "CMD (helper routines):" + echo -e "\tdocs - high level target to run docs_readme and docs_history (see below)\n" echo -e "\tdocs_readme - generate & OVERWRITE(!) README.md inside Documentation/ based on nav section from mkdocs.yml if it changed\n" + echo -e "\tdocs_history - check if History.md has the changelog for the latest stable release\n" echo -e "\tcheck_style_file SRC - run code style checks based on clang-format & custom parsers for source code file SRC\n" echo -e "\tcheck_style_log - run clang-format using source/Makefile and generate gcc-compatible error log in source/check-style.log\n" echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n" @@ -71,6 +73,23 @@ EOF return "${ret}" } +# Documentation/History.md automagical changelog routine +docs_history() +{ + md="Documentation/History.md" + ver_md="$(sed -ne 's/^## //1p' "${md}" | head -1)" + echo "Latest changelog: ${ver_md}" + ver_git="$(git tag -l | sort | grep -e "^v" | grep -v "rc" | tail -1)" + echo "Latest release tag: ${ver_git}" + ret=0 + if [ "${ver_md}" != "${ver_git}" ]; then + ret=1 + echo "It seems there is no changelog information for ${ver_git} in ${md} yet." + echo "Please, update changelog information in ${md}." + fi; + return "${ret}" +} + # Helper function to check code style using clang-format & grep/sed custom parsers: # - basic logic moved from source/Makefile : `check-style` target for better maintainance since a lot of sh script involved; # - output goes in gcc-like error compatible format for IDEs/editors. @@ -126,27 +145,42 @@ docker_file="-f ${root_dir}/${docker_conf}" # (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh) if [ -z "${DOCKER_BIN}" ]; then - docker_bin="" + docker_app="" else - docker_bin="${DOCKER_BIN}" + docker_app="${DOCKER_BIN}" fi; # detect availability of docker docker_compose="$(command -v docker-compose)" -if [ -n "${docker_compose}" ] && [ -z "${docker_bin}" ]; then - docker_bin="${docker_compose}" +if [ -n "${docker_compose}" ] && [ -z "${docker_app}" ]; then + docker_app="${docker_compose}" fi; docker_tool="$(command -v docker)" -if [ -n "${docker_tool}" ] && [ -z "${docker_bin}" ]; then - docker_bin="${docker_tool} compose" +if [ -n "${docker_tool}" ] && [ -z "${docker_app}" ]; then + docker_app="${docker_tool} compose" fi; # give function argument a name cmd="${1}" +# meta target to verify markdown documents + +if [ "docs" = "${cmd}" ]; then + docs_readme + readme="${?}" + docs_history + hist="${?}" + if [ "${readme}" -eq 0 ] && [ "${hist}" -eq 0 ]; then + ret=0 + else + ret=1 + fi; + exit ${ret} +fi; + # if only README.md for Documentation update is required then run it & exit if [ "docs_readme" = "${cmd}" ]; then @@ -154,6 +188,13 @@ if [ "docs_readme" = "${cmd}" ]; then exit "${?}" fi; +# if only History.md for Documentation update is required then run it & exit + +if [ "docs_history" = "${cmd}" ]; then + docs_history + exit "${?}" +fi; + if [ "check_style_file" = "${cmd}" ]; then check_style_file "${2}" exit "${?}" @@ -166,7 +207,7 @@ fi; # if docker is not presented in any way show warning & exit -if [ -z "${docker_bin}" ]; then +if [ -z "${docker_app}" ]; then echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again." exit 1 fi; @@ -194,6 +235,6 @@ if [ "${cmd}" = "shell" ]; then echo -e "\t* type \"exit\" to end the session when done;" fi; echo -e "\t* type \"${0} clean\" to delete created container (but not cached data)" -echo -e "\n====>>>> ${docker_bin} ${docker_file} ${docker_cmd}\n" -eval "${docker_bin} ${docker_file} ${docker_cmd}" +echo -e "\n====>>>> ${docker_app} ${docker_file} ${docker_cmd}\n" +eval "${docker_app} ${docker_file} ${docker_cmd}" exit "${?}" |