The ideal is Cool and Dry.
Cold will not - not - damage properly-made small arms ammo.
Heat will because it accelerates the chemical processes leading to the breakdown of propellant. In very early smokeless propellant, especially in large quantities, this could lead to catastrophic results - several battleships and ammunition depots were lost due to deteriorating propellant. Modern propellant is less likely to become dangerous, but I remember finding a box of .22LR I'd forgotten for some years in my car trunk (parked outside during hot Ontario summers). I tried about 20 rounds and had maybe one go off.
It takes a while for heat to make a difference, though. Remember Gulf One, with huge stacks of ammo all over the countryside for months in what amounted to an oven. It worked just fine when needed.
Rapid cycling between hot and cold is not a good idea.
Modest amounts of dampness will not hurt small arms ammo. High amounts might, but consider that you can drop ammo into water for a week and 99.99+% of it will fire. Moisture in the air is less likely than that to cause problems. It will however degrade packaging if exposure is prolonged. Air-tight packaging will be quite sufficient to protect the ammo itself from moisture.
(One consideration in a garage is the presence of solvents like gasoline, naphtha, oils and such. If you're worried about water vapour causing problems, imagine what such chemicals can do. Again, air-tight packaging is probably enough if it's a concern.)
Not sure what your situation is, but if you absolutely must store it in a garage which is subject to extreme seasonal heating, there are some possible ways to ameliorate the problem:
The first is to install vents, especially roof vents, to exchange inside air for cooler outside air.
Second, if that doesn't keep it reasonably cool inside, think about installing a small air conditioner. It doesn't have to keep the garage comfortable, just not outrageously hot.
If cooling the whole garage is an issue, consider building an insulated closet big enough for your ammo and air-condition just that with the smallest window rig you can find. This would also have the advantage of being lockable.
Even an old refrigerator would work, if large enough and fitted with shelves strong enough. You'd have to keep it set fairly warm (as fridges go) because of condensation when you take the ammo out on a hot day. A hasp would provide security if desired.
An cool space is also generally dryer if moisture concerns you.