Cristiano Ronaldo has announced his retirement from international football.