If you have the inclination and time, you could bundle your CDs into "lots" and sell them on Discogs/Ebay. So if you have several CDs of certain composers, bundle them like a box set and sell them that way.
The alternative is to trade them in for store credit and then sell the credit to someone else for cash and donate what you can't sell/trade in.
My friends were surprised when I told them I still buy CDs but it's because I'm looking for better sound than streaming, and some artists' back catalogs were never released on vinyl. And if I'm buying used/new from abroad, I prefer CDs as the chances of damaged vinyl are too great.