Start a Editor script only after a successfull build

I need to start a function after only a successful build. I have tried using the OnPostprocessBuild function from IPostprocessBuildWithReport, however as this is called during the build process and not after, I have no chance of finding out, whether this build failed or was successful.
Any way to do this?

EDIT: I forgot to mention that I am building for Android.

OnPostprocessBuild should give you a BuildReport. The BuildReport has a BuildSummary which in turn has a BuildResult which should be enough to determine if the build was successful or not. The summary has several other information such as the errors and / or warnings that were encountered

So this should actually work:

public void OnPostprocessBuild(BuildReport report)
{
    if (report.summary.result == UnityEngine.Build.Reporting.BuildResult.Succeeded)
    {
        Debug.Log("Build successful");
    }
}

Of course note that some build targets which build to an intermediate project (like on iOS were an xcode project is generated) the build process may not be completed. However the building from the Unity side is done. Everything that happens is outside the domain of Unity.