How do I make a cube gently bob up and down while also rotating?

I was told I could use a timeline but how do I go about doing that?

And

Make sure that the timeline isolates the Z axis! Otherwise it will interfere with the rotation.