The secret is
http://www.yosemitesites.com
This privately-run website is not associated with the National Park Service or even the reservation agent. It shows when and where campgrounds are available in Yosemite and a few other National Parks.
When you see a campground and date you like, go to
www.recreation.gov and reserve the site. Don't wait too long if you want to go in Summer.
You can only reserve 5 months ahead.