I know that single-action when used for handguns mean that the gun doesn't have to be cocked in order to fire, but I also saw the phrase "single-action rifle", "single-action shotgun", "single-action submachine gun". I was wondering if "single-action" meant the same thing for all guns, because as far as I know only handguns have to be cocked. After googling, I heard "single-action rifle" meant "bolt-action rifle", is this true?
Most guns have to be 'cocked', not just handguns. Sub-machine guns, machine guns, rifles, shotguns, all are cocked before use. Example discussion for bolt-action rifles:
Bolt action is a type of firearm action where the handling of cartridges into and out of the weapon's barrel chamber is operated by manually manipulating the bolt directly via a handle, which is most commonly placed on the right-hand side of the weapon (as most users are right-handed). When the handle is operated, the bolt is unlocked from the receiver and pulled back to open the breech, allowing the spent cartridge case to be extracted and ejected, the firing pin within the bolt is cocked (either on opening or closing of the bolt depending on the gun design) and engages the sear, then upon the bolt being pushed back a new cartridge (if available) is loaded into the chamber, and finally the breech is closed tight by the bolt locking against the receiver.
You aren't working from an appropriate definition of "single-action": (Firearms, Gunnery, Ordnance & Artillery) (modifier) (of a firearm) requiring the hammer to be cocked by hand before firing.
Double-action means the trigger both cocks and fires the gun as explained in this article about the difference between double and single action.
The difference between a hand gun and a rifle is basically barrel length and the stock on a rifle that allows you to shoulder it. The "action" doesn't matter.
The "Trigger" article in Everipedia explains what is meant by an "action" when discussing firearms.
There are numerous types of action, where action refers to the mechanism (the trigger, hammer, and safeties considered as a unit) or to the logic of how it is built and how it is used. They are categorized according to which functions the trigger is to perform. In addition to releasing the hammer or the striker, a trigger may cock the hammer or striker, rotate a revolver's cylinder, deactivate passive safeties, select between semi-automatic and full-automatic fire such as the Steyr AUG (see progressive trigger), or pre-set a "set trigger". Most modern firearms use the trigger to deactivate passive safeties but this does not change how they are identified.