build: Support uploading releases separately from building

diff --git a/build.gradle b/build.gradle
index c3263d6..dde7b2d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -317,8 +317,12 @@
             authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword)
           }
         }
-        repository(url: stagingUrl, configureAuth)
-        snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth)
+        if (rootProject.hasProperty('repositoryDir')) {
+          repository(url: new File(rootProject.repositoryDir).toURI())
+        } else {
+          repository(url: stagingUrl, configureAuth)
+          snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/', configureAuth)
+        }
     }
     uploadArchives.onlyIf { !name.contains("grpc-gae-interop-testing") }