Add conditional signing

Changed two things:
1) signing will be skipped if uploadArchives is not in TaskGraph (note the curly brakets)
2) sonatypeUsername & sonatypePassword are only needed when the sonatype Repository is used for uploading

I checked locally and I can execute the build task and signArchives is being skipped. I do not have a gradle.properties file. I could not check if uploading still works, since I have no sonatype access. But the properties should be evaluated at execution time and not at configuration time, so it should be fine.