Skip to content

Commit 90b6735

Browse files
cortinicofacebook-github-bot
authored andcommitted
Invoke closeAndReleaseSonatypeStagingRepository in the publish gradle invocation (#35272)
Summary: This PR ports back into main the changes required to properly close the SonaType repository on Maven ## Changelog [General] [Fixed] - Close the Maven repository properly Pull Request resolved: #35272 Test Plan: We tested these changed in 0.71-stable branch when releasing 0.71.0-RC.0 Reviewed By: christophpurrer Differential Revision: D41154965 Pulled By: cipolleschi fbshipit-source-id: 74dd46e8fabf3baef544342282829c70d92f671f
1 parent 37fbc16 commit 90b6735

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

scripts/release-utils.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,30 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
5252

5353
function publishAndroidArtifactsToMaven(releaseVersion, isNightly) {
5454
// -------- Publish every artifact to Maven Central
55-
// The GPG key is base64 encoded on CircleCI
55+
// The GPG key is base64 encoded on CircleCI and then decoded here
5656
let buff = Buffer.from(env.ORG_GRADLE_PROJECT_SIGNING_KEY_ENCODED, 'base64');
5757
env.ORG_GRADLE_PROJECT_SIGNING_KEY = buff.toString('ascii');
58-
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
59-
echo('Failed to publish artifacts to Sonatype (Maven Central)');
60-
exit(1);
61-
}
6258

6359
// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
6460
// maven central which will break the semver for our artifacts.
6561
if (!isNightly && releaseVersion.startsWith('0.')) {
6662
// -------- For stable releases, we also need to close and release the staging repository.
67-
if (exec('./gradlew closeAndReleaseSonatypeStagingRepository').code) {
63+
if (
64+
exec(
65+
'./gradlew publishAllToSonatype closeAndReleaseSonatypeStagingRepository',
66+
).code
67+
) {
6868
echo(
6969
'Failed to close and release the staging repository on Sonatype (Maven Central)',
7070
);
7171
exit(1);
7272
}
73+
} else {
74+
// -------- For nightly releases, we only need to publish the snapshot to Sonatype snapshot repo.
75+
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
76+
echo('Failed to publish artifacts to Sonatype (Maven Central)');
77+
exit(1);
78+
}
7379
}
7480

7581
echo('Published artifacts to Maven Central');

0 commit comments

Comments
 (0)