Not by any means, since many things might be and have to be weighted before such an important decision that interferes with so many lives.
It is dependent on the force of the assault just as the intensity of the assaulting country.
Also, it is important to remember that quite a few nations have been assaulted and actually never battled back. In fact, surrendering has been proven an option that might actually save more lives in many situations. Specially if you consider that the country that is assaulting might be the more dominant when it comes to be about fire power.
There is also the option of trying to punish an specific responsible by it or using of sanctions when it's the case of no human casualties and so on.
It is reliant on the intensity of the attack as well as the power of the attacking nation. some countries have been attacked and literally never fought back but surrendered if the attacking nation is more powerful in terms of military power. in case the intensity of the attack can be absorbed, a country can also opt for diplomacy as war is the ultimate sanction in international relation. in case the country feels it has the capacity to protect its sovereignty then fighting back is the only option.