@@ -610,3 +610,39 @@ def gpg_sign_file(self, subject, repo, file_path, key_subject=None, passphrase=N
610610
611611 self ._logger .info ("Sign successfully: {}" .format (url ))
612612 return response
613+
614+ # Content Sync
615+
616+ def sync_version_artifacts_to_maven_central (self , subject , repo , package , version , username ,
617+ password , close = "1" ):
618+ """ Sync version files to a oss.sonatype.org staging repository to publish these files to
619+ Maven Central.
620+
621+ Once Sonatype oss credentials have been set in subject "Accounts" tab, user can send
622+ this rest call without specifying username and password (or use different
623+ username/password by specifying them in JSON body)
624+
625+ By default the staging repository is closed and artifacts are released to Maven Central.
626+ You can optionally turn this behaviour off and release the version manually.
627+ This is achieved by passing 0 in the 'close' field of the JSON passed to the call.
628+
629+ Security: Authenticated user with 'publish' permission.
630+
631+ :param subject: username or organization
632+ :param repo: repository name
633+ :param package: package name
634+ :param version: package version
635+ :param username: Sonatype OSS user token
636+ :param password: Sonatype OSS user password
637+ :param close: staging repository mode
638+ :return: request response
639+ """
640+ url = "{}/maven_central_sync/{}/{}/{}/versions/{}" .format (Bintray .BINTRAY_URL , subject ,
641+ repo , package , version )
642+ body = {
643+ 'username' : username ,
644+ 'password' : password ,
645+ 'close' : close
646+ }
647+
648+ return self ._requester .post (url , json = body )
0 commit comments