How to execute custom task in mix releases step?
steps: [:assemble, Mix.Task.run("mytask"), :tar]
** (Mix.NoTaskError) The task "mytask" could not be found
mix mytask works fine.
I don’t know but I am calling a function in my steps this way:
steps: [©_datadog_files/1, :assemble]
and then I have
defp copy_datadog_files(release) do ... in
mix.exs file that defines such function. I guess you can execute Mix task from that function too, but I never tried it or know if there’s better way
Mix.task.run("mytask") tries to literally run the task at that very moment. It doesn’t return a value that is then added as a step.
I’ve moved it to function and it worked.
And thank you for your advice. Now I got it.
If I could, I would mark your post as a solution too