Exporting glTF animations are briefly covered in this section of the Blender Manual.
When you have multiple different animations to store in a single glTF, they can be encoded separately using the Nonlinear Animation panel, as "NLA" tracks.
Click the Push Down Action button. After clicking it, the result will look something like this:
Double-click "NlaTrack" and rename it to the name of the animation that you would like to see in the exported glTF file. If multiple objects are to move as part of a single animation, copy-and-paste this name exactly to all of the NLA tracks that participate in the animation.
After exporting to glTF, all NLA tracks with exactly the same name will be rolled into a single glTF animation of that name. NLA tracks with different names will be different animations within the file.
Some time ago I made a YouTube video demoing this process.