Skip to content

Commit cd39e4c

Browse files
cortinicoRiccardo Cipolleschi
authored and
Riccardo Cipolleschi
committed
[LOCAL] Invoke closeAndReleaseSonatypeStagingRepository in the publish gradle invocation
1 parent 114098d commit cd39e4c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

scripts/release-utils.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,31 @@ 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 -PisNightly=' +
66+
isNightly,
67+
).code
68+
) {
6869
echo(
6970
'Failed to close and release the staging repository on Sonatype (Maven Central)',
7071
);
7172
exit(1);
7273
}
74+
} else {
75+
// -------- For nightly releases, we only need to publish the snapshot to Sonatype snapshot repo.
76+
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
77+
echo('Failed to publish artifacts to Sonatype (Maven Central)');
78+
exit(1);
79+
}
7380
}
7481

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

0 commit comments

Comments
 (0)