Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing via the Central Portal #721

Closed
m3is0 opened this issue Jul 23, 2024 · 12 comments
Closed

Publishing via the Central Portal #721

m3is0 opened this issue Jul 23, 2024 · 12 comments

Comments

@m3is0
Copy link

m3is0 commented Jul 23, 2024

Since recently, all new Sonatype accounts must publish via the Central Portal:
https://central.sonatype.org/register/central-portal/

I've successfully published my project with sbt-ci-release and sbt-sonatype v3.11.0 (which supports the new API),
but with sbt-typelevel-ci-release v0.7.2 (which includes the same sbt-sonatype) it doesn't work.

I tried to set SONATYPE_CREDENTIAL_HOST, but with no success.

@armanbilge
Copy link
Member

armanbilge commented Jul 23, 2024

Thanks for trying this!

it doesn't work.

How do you know that it didn't work? Are there logs or some kind of error message?

I tried to set SONATYPE_CREDENTIAL_HOST, but with no success.

How did you try to set it? can you share your build.sbt?

@kubukoz
Copy link
Member

kubukoz commented Jul 23, 2024

For the record, sbt-sonatype 3.11.0 should support the new API: xerial/sbt-sonatype#474 (issue: xerial/sbt-sonatype#465)

and sbt-typelevel uses that in 0.7.2.

@m3is0
Copy link
Author

m3is0 commented Jul 23, 2024

As @kubukoz mentioned, I get the following error:

scala.MatchError: URLRepository(https://SettingKey(This / This / This / sonatypeCredentialHost), Patterns(ivyPatterns=Vector(), artifactPatterns=Vector(), isMavenCompatible=false, descriptorOptional=false, skipConsistencyCheck=false), false) (of class sbt.librarymanagement.URLRepository)
	at org.typelevel.sbt.TypelevelSonatypeCiReleasePlugin$.$anonfun$tlCiReleaseCommand$4(TypelevelSonatypeCiReleasePlugin.scala:75)
...

@aartigao
Copy link

FYI, I've tried 👇🏽

addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.2-8-ce3d86e-SNAPSHOT")

and works! 🎉 Thanks @kubukoz!

(beware that, for the moment, publishing snapshots is not supported and your CI will fail).

@kubukoz
Copy link
Member

kubukoz commented Jul 27, 2024

@aartigao did you identify where the problem with snapshots comes from?

@aartigao
Copy link

If I read correctly it's just that it is not supported yet by SBT Sonatype.

@m3is0
Copy link
Author

m3is0 commented Jul 27, 2024

It works well with SONATYPE_CREDENTIAL_HOST = "central.sonatype.com" as an actions secret!

Thanks to you guys, and thanks to @kubukoz for fixing this so quickly!

With ThisBuild / sonatypeCredentialHost := xerial.sbt.Sonatype.sonatypeCentralHost it doesn't work.

It still uses the default host:

2024-07-27 20:14:52.597Z  info [SonatypeService] sonatypeRepository  : https://s01.oss.sonatype.org/service/local  - (SonatypeService.scala:26)
...
2024-07-27 20:14:54.120Z error [Sonatype] 
wvlet.airframe.http.HttpClientException: [401: Unauthorized]

Is this expected?

@m3is0
Copy link
Author

m3is0 commented Jul 29, 2024

I think the above problem is related to the following code:

sonatypeCredentialHost := {
Option(System.getenv("SONATYPE_CREDENTIAL_HOST")).filter(_.nonEmpty).getOrElse {
if (tlSonatypeUseLegacyHost.value)
"oss.sonatype.org"
else
"s01.oss.sonatype.org"
}
},

@armanbilge
Copy link
Member

armanbilge commented Jul 29, 2024

@m3is0 Yes, it's a scoping problem. Originally, sbt-sonatype required that sonatypeCredentialHost be scoped at the project-level instead of the ThisBuild-level. However, it looks like that was changed in xerial/sbt-sonatype@7074090, so now our code is broken.

@m3is0
Copy link
Author

m3is0 commented Jul 29, 2024

Thanks @armanbilge !

@kubukoz
Copy link
Member

kubukoz commented Aug 19, 2024

The 0.7.2-12-17ac909-SNAPSHOT version has worked for us, any chance we can get a patch soon?

@armanbilge
Copy link
Member

@kubukoz we need to fix one more thing before we can release:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants