build(mix): copy generated docs to release

This commit is contained in:
Zaiming (Stone) Shi 2022-06-12 20:05:02 +02:00
parent 668a31a696
commit c76d5c0181
3 changed files with 25 additions and 3 deletions

View File

@ -224,7 +224,7 @@ prepare-build-deps:
## elixir target is to create release packages using Elixir's Mix
.PHONY: $(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir)
$(REL_PROFILES:%=%-elixir) $(PKG_PROFILES:%=%-elixir): $(COMMON_DEPS) $(ELIXIR_COMMON_DEPS) mix-deps-get
@$(BUILD) $(subst -elixir,,$(@)) elixir
@env IS_ELIXIR=yes $(BUILD) $(subst -elixir,,$(@)) elixir
.PHONY: $(REL_PROFILES:%=%-elixir-pkg)
define gen-elixir-pkg-target

4
build
View File

@ -293,8 +293,8 @@ export_release_vars() {
log "building artifact=$ARTIFACT for profile=$PROFILE"
case "$ARTIFACT" in
doc)
make_doc
doc|docs)
make_docs
;;
rel)
make_rel

22
mix.exs
View File

@ -114,6 +114,7 @@ defmodule EMQXUmbrella.MixProject do
} = check_profile!()
base_steps = [
&make_docs(&1),
:assemble,
&create_RELEASES/1,
&copy_files(&1, release_type, package_type, edition_type),
@ -283,6 +284,12 @@ defmodule EMQXUmbrella.MixProject do
# Custom Steps
#############################################################################
defp make_docs(release) do
profile = System.get_env("MIX_ENV")
os_cmd("build", [profile, "docs"])
release
end
defp copy_files(release, release_type, package_type, edition_type) do
overwrite? = Keyword.get(release.options, :overwrite, false)
@ -322,6 +329,21 @@ defmodule EMQXUmbrella.MixProject do
force: overwrite?
)
# copy generated docs
Enum.each(
[
"apps/emqx_dashboard/priv/www/static/emqx-en.conf.example",
"apps/emqx_dashboard/priv/www/static/emqx-zh.conf.example"
],
fn file ->
Mix.Generator.copy_file(
file,
Path.join(etc, Path.basename(file)),
force: overwrite?
)
end
)
# this is required by the produced escript / nodetool
Mix.Generator.copy_file(
Path.join(release.version_path, "start_clean.boot"),