@@ -52,24 +52,31 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
52
52
53
53
function publishAndroidArtifactsToMaven ( releaseVersion , isNightly ) {
54
54
// -------- 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
56
56
let buff = Buffer . from ( env . ORG_GRADLE_PROJECT_SIGNING_KEY_ENCODED , 'base64' ) ;
57
57
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
- }
62
58
63
59
// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
64
60
// maven central which will break the semver for our artifacts.
65
61
if ( ! isNightly && releaseVersion . startsWith ( '0.' ) ) {
66
62
// -------- 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
+ ) {
68
69
echo (
69
70
'Failed to close and release the staging repository on Sonatype (Maven Central)' ,
70
71
) ;
71
72
exit ( 1 ) ;
72
73
}
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
+ }
73
80
}
74
81
75
82
echo ( 'Published artifacts to Maven Central' ) ;
0 commit comments