As others have mentioned, your route is full of great places to stop. But here is a suggestion for a different route to San Sebastian.
After leaving the Douro Valley, head to Ourense in Galicia. Then instead of hitting the coast, head south and follow the Duero east. So Benavente (maybe Zamora) then Valladolid. Keep heading east, visiting Peñafiel and Aranda de Duero. El Burgo de Osma is a real hidden gem. Continue on to Soria and Tarazona. From Tarazona turn north. Visit Olite, a nice place to stay. From there you can continue up to San Sebastian.
There are many things to visit along the way. Of course you are in the heart of the Ribera del Duero wine area. There are a lot of castles to visit along the way. The castle of Peñafiel houses a wine museum. If El Cid is of interest you can visit some places that were important in his story. There are also Roman ruins to visit, and the ruins of Numancia outside of Soria is a great example.
In Soria there are also several natural parks and reserves that make for good light hikes. For example in the Cañon del Rio Lobos, the hike up to the Ermita de San Bartolome is very popular. The Reserva natural de Sabinar de Calatañor has lots of routes to hike.
A personal favorite is Yanguas, between Soria and Rioja. If you are interested in dinosaurs, there are many dig sites in the area. The town is one of the “Pueblos Más Bonitos de España” and there are several hikes that go out from the town. On a sidenote, near by is San Felices and it know for it's lavender fields, and they should be in bloom in July.
Just to finish off, before going to San Sebastian, take a look at the Baztan Valley. It is a very beautiful area in Navarra. It also give easy access to the French Basque country. At the eastern edge there are seveal caves, like Zugarramurdi, which is famous for the witches who used it in the 16th century. Also on this end of the valley is the mountain Gorramendi, 1074m. There are many hiking paths in the area. From there you can see both the coast and the Pyrenees. Today there is a cell tower, but in the 50's and 60's there was a US Army radar station there.
I like the southern entrance into the French Basque Country, going through the Izpegi pass. There are some incredible views of the Pyrenees. It is also popular for hiking. You can take a walk around the area and then eat in one of the restaurants there. From Izpegi, you go down to Baigorri and San Juan Pie de Puerto.