@@ -73,24 +73,31 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
73
73
74
74
function publishAndroidArtifactsToMaven ( releaseVersion , isNightly ) {
75
75
// -------- 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
77
77
let buff = Buffer . from ( env . ORG_GRADLE_PROJECT_SIGNING_KEY_ENCODED , 'base64' ) ;
78
78
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
- }
83
79
84
80
// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
85
81
// maven central which will break the semver for our artifacts.
86
82
if ( ! isNightly && releaseVersion . startsWith ( '0.' ) ) {
87
83
// -------- 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
+ ) {
89
90
echo (
90
91
'Failed to close and release the staging repository on Sonatype (Maven Central)' ,
91
92
) ;
92
93
exit ( 1 ) ;
93
94
}
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
+ }
94
101
}
95
102
96
103
echo ( 'Published artifacts to Maven Central' ) ;
0 commit comments