If `$X` is the parameter where the new version is stored,

 ed file << EOF
 g/^version =/s/.*/version = '$X'/
 g/^release =/s/.*/release = '$X'/
 w
 q
 EOF