I don't think that equating all open source work with volunteering makes sense.
Volunteering is defined by its charitable purpose for a public good, not by the specific skill used.
Let me try an analogy:
A chef who cooks a free meal for a homeless shelter is volunteering. That same chef publishing a recipe online or making a cooking tutorial is sharing knowledge, not volunteering. The act of 'cooking' or 'publishing' is neutral. It becomes volunteering only when the primary, direct, and organised purpose is to serve a charitable cause without expectation of personal gain.
Disclaimer: I have been consistently doing a lot of open source in the last 10 years. I would consider none of that as volunteering.