pre-compile.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. [ "${DEBUG:-0}" -eq 1 ] && set -x
  4. # NOTE: PROFILE_STR may not be exactly PROFILE (emqx or emqx-enterprise)
  5. # it might be with suffix such as -pkg etc.
  6. PROFILE_STR="${1}"
  7. case "$PROFILE_STR" in
  8. *enterprise*)
  9. dashboard_version="$EMQX_EE_DASHBOARD_VERSION"
  10. ;;
  11. *)
  12. dashboard_version="$EMQX_DASHBOARD_VERSION"
  13. ;;
  14. esac
  15. # ensure dir
  16. cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
  17. ./scripts/get-dashboard.sh "$dashboard_version"
  18. # generate merged config files and English translation of the desc (desc.en.hocon)
  19. ./scripts/merge-config.escript
  20. I18N_REPO_BRANCH="v$(./pkg-vsn.sh "${PROFILE_STR}" | tr -d '.' | cut -c 1-2)"
  21. DOWNLOAD_I18N_TRANSLATIONS=${DOWNLOAD_I18N_TRANSLATIONS:-true}
  22. # download desc (i18n) translations
  23. if [ "$DOWNLOAD_I18N_TRANSLATIONS" = "true" ]; then
  24. echo "downloading i18n translation from emqx/emqx-i18n"
  25. start=$(date +%s)
  26. curl -L --silent --show-error \
  27. --output "apps/emqx_dashboard/priv/desc.zh.hocon" \
  28. "https://raw.githubusercontent.com/emqx/emqx-i18n/${I18N_REPO_BRANCH}/desc.zh.hocon"
  29. end=$(date +%s)
  30. duration=$(echo "$end $start" | awk '{print $1 - $2}')
  31. echo "downloaded i18n translation in $duration seconds, set DOWNLOAD_I18N_TRANSLATIONS=false to skip"
  32. else
  33. echo "skipping to download i18n translation from emqx/emqx-i18n, set DOWNLOAD_I18N_TRANSLATIONS=true to update"
  34. fi
  35. # TODO
  36. # make sbom a build artifact
  37. # ./scripts/update-bom.sh "$PROFILE_STR" ./rel