Improve release.sh

Redo of #2829.