How to execute custom task in mix releases step?
In mix.exs:
releases: [ myapp: [ overwrite: true, include_executables_for: [:unix], steps: [:assemble, Mix.Task.run("mytask"), :tar] ] ]
Results in
** (Mix.NoTaskError) The task "mytask" could not be found
error.
But the 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
3 Likes
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.
3 Likes
I’ve moved it to function and it worked.
Thank you!
1 Like
And thank you for your advice. Now I got it.
If I could, I would mark your post as a solution too 
1 Like