Skip to content

Commit e4f23f4

Browse files
committed
[LOCAL] Invoke closeAndReleaseSonatypeStagingRepository in the publish gradle invocation
1 parent 27c32b2 commit e4f23f4

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

scripts/release-utils.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,31 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
7373

7474
function publishAndroidArtifactsToMaven(releaseVersion, isNightly) {
7575
// -------- Publish every artifact to Maven Central
76-
// The GPG key is base64 encoded on CircleCI
76+
// The GPG key is base64 encoded on CircleCI and then decoded here
7777
let buff = Buffer.from(env.ORG_GRADLE_PROJECT_SIGNING_KEY_ENCODED, 'base64');
7878
env.ORG_GRADLE_PROJECT_SIGNING_KEY = buff.toString('ascii');
79-
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
80-
echo('Failed to publish artifacts to Sonatype (Maven Central)');
81-
exit(1);
82-
}
8379

8480
// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
8581
// maven central which will break the semver for our artifacts.
8682
if (!isNightly && releaseVersion.startsWith('0.')) {
8783
// -------- For stable releases, we also need to close and release the staging repository.
88-
if (exec('./gradlew closeAndReleaseSonatypeStagingRepository').code) {
84+
if (
85+
exec(
86+
'./gradlew publishAllToSonatype closeAndReleaseSonatypeStagingRepository -PisNightly=' +
87+
isNightly,
88+
).code
89+
) {
8990
echo(
9091
'Failed to close and release the staging repository on Sonatype (Maven Central)',
9192
);
9293
exit(1);
9394
}
95+
} else {
96+
// -------- For nightly releases, we only need to publish the snapshot to Sonatype snapshot repo.
97+
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
98+
echo('Failed to publish artifacts to Sonatype (Maven Central)');
99+
exit(1);
100+
}
94101
}
95102

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

0 commit comments

Comments
 (0)