Before that happens the Sun will expand out to about the orbit of Mars, well beyond the Earth.
All planets within that orbit level are doomed and have a time limit upon them. All life on those planets is in jeopardy in the very long run:
Earth's fate is precarious. As a red giant, the Sun will have a maximum radius beyond the Earth's current orbit, 1 AU (1.5×1011 m), 250 times the present radius of the Sun. However, by the time it is an asymptotic giant branch star, the Sun will have lost roughly 30% of its present mass due to a stellar wind, so the orbits of the planets will move outward. If it were only for this, Earth would probably be spared, but new research suggests that Earth will be swallowed by the Sun owing to tidal interactions. Even if Earth would escape incineration in the Sun, still all its water will be boiled away and most of its atmosphere would escape into space.(Tenet One Basics). The only way out for the human race, according to non-religious doctrine, is to learn space travel.
After that humanity must colonize other planets within the solar system first, then branch out to other solar systems in this galaxy.
In other words find another habitable planet before the Sun destroys us.
To do that the people of the earth are going to have to allow the earth to last perhaps one to two million years. Who knows, maybe more, because it depends on technology and its proper use.
But the earth can't be destroyed or the story is over. The human story will be over.
So the mission for humanity is to survive that long. At the current rates the earth will be destroyed by humanity well before that time. We are headed for that disaster if we don't care for the planet and for ourselves.
To survive we must learn to live together, eventually get rid of the weaponry that would destroy humanity if used. We must have a functioning world order where nations live together in peace like our states live together and let live here in the United States.
The petty, mindless, and doomed wars and fightings while thousands starve each day has got to go. Or humanity has to go.
Noam Chomsky says it is not clear that we will make it long enough to mature.
Perhaps it is natural for species, who cannot develop social skills, to perish.
It looks as if the solar expansion and collapse in the great distance of time is sort of a time limit or the test.
We are very, very, very far from that date ... yet we are considering human survival even now, because we seem to want to beat the Sun to utter human destruction.
That is to say we are underscoring the notion that perhaps we can't make it to that distant date under our current social means and methods. The critical skills are missing.
We need survival skills.
If we were to escape off into space beyond our solar system before we became cosmic, mature, and wise adults, we would only be spreading the disease to another location.
If we did solve our social problems before the solar problem gets us, and did develop the skill of space travel, then we would be spreading social wisdom out into the universe.
We have to decide which side we are on ... destruction of life or survival of life ... then work in that direction.
While browsing I found a David Ho painting that depicts (to me anyway) humanity's current efforts to find a new star. I found it at astropixie, a very interesting blog.