To be fair, it's likely that a town or village will have a posted lookout or two who will spot the dragon coming from a long way away, since it's likely (a) flying and (b) a gigantic, brightly-colored mass against the sky, which is hard to stealth against unless you're a blue dragon. Which should give a town a tiny bit of time to prepare.Ah, yes, I forgot. These are commoners whi are spending every moment of every day with their longbows in their hands, readying their actions against a dragon attack.
The dragon wins without doing anything: the villagers all starved to death years ago from being unable to harvest or even feed themselves.
Fantasy towns don't have minutemen; they have 1d4+1 round'smen.
In reality, though, I don't think villages and towns are going to try to fight a dragon unless there's a lot of retired adventurers living there or commoners are routinely taught enough tactics and practice combat enough that they all count as 5th+ level fighters. I think they'd be more likely to go the tribute route. "Here, have a youth/maiden" deal.