Skip to content

Commit

Permalink
[LOCAL] Invoke closeAndReleaseSonatypeStagingRepository in the publis…
Browse files Browse the repository at this point in the history
…h gradle invocation
  • Loading branch information
cortinico committed Nov 4, 2022
1 parent 27c32b2 commit e4f23f4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions scripts/release-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,31 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {

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

// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
// maven central which will break the semver for our artifacts.
if (!isNightly && releaseVersion.startsWith('0.')) {
// -------- For stable releases, we also need to close and release the staging repository.
if (exec('./gradlew closeAndReleaseSonatypeStagingRepository').code) {
if (
exec(
'./gradlew publishAllToSonatype closeAndReleaseSonatypeStagingRepository -PisNightly=' +
isNightly,
).code
) {
echo(
'Failed to close and release the staging repository on Sonatype (Maven Central)',
);
exit(1);
}
} else {
// -------- For nightly releases, we only need to publish the snapshot to Sonatype snapshot repo.
if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) {
echo('Failed to publish artifacts to Sonatype (Maven Central)');
exit(1);
}
}

echo('Published artifacts to Maven Central');
Expand Down

0 comments on commit e4f23f4

Please sign in to comment.