I am attaching the problem here:

Since I want to use the energy approach I must require the height of the centre of mass of the rod at the initial and required (angle $\phi$) position.
For the vertical position if I take $h1$ as the height then I get cos$\alpha$ = h1/(a+x) where x is the extension of the rod that meets the base of inclined plane.
How do I calculate the other Height (at $\phi$)?

Considering a referential with origin at $A$ and rotated for $\alpha$ clockwise, the work done by gravity is
$$ U_{\alpha}=m g(a - a \sin\phi) $$
and in the inertial frame we have
$$ U = U_{\alpha}\cos\alpha = m g a \cos\alpha(1-\sin\phi) $$