defmodule Mix.Tasks.Deployment.CanDeploy do use Mix.Task @shortdoc "Indicates if the latest relase can be deployed" @moduledoc " If the local release's `relup` (generated by relx) correctly transtions from the remote version to the local version, prints 'yes' and exits normally, otherwise prints 'no' and exits with a non-zero exit code. " def run([stage]) do {:ok, remote_version} = Exdm.Remote.get_version(String.to_atom(stage)) handle_can_transition_from(Exdm.Local.can_transition_from(remote_version)) end defp handle_can_transition_from({:ok}) do IO.puts "yes" end defp handle_can_transition_from({:error, reason}) do IO.puts "no" raise reason end end