sbt / sbt-ci-release

sbt plugin to automate Sonatype releases from GitHub Actions
Apache License 2.0
286 stars 76 forks source link

Sonatype repository change since February 2021 #181

Closed djice closed 3 years ago

djice commented 3 years ago

Hi,

I've just created a new component and I want to push it on sonatype using your plugin.

I have an issue in github action for task "run sbt ci-release"

[error] java.io.IOException: Server returned HTTP response code: 403 for URL: https://oss.sonatype.org/content/repositories/snapshots/io/github/***/core_2.11/1.0.0-SNAPSHOT/core_2.11-1.0.0-SNAPSHOT.pom

The url used to push the snapshot is https://oss.sonatype.org When I read the official documentation of sonatype https://central.sonatype.org/pages/releasing-the-deployment.html it seems that since feburary the server to used is not "oss.sonatype.org" but "s01.oss.sonatype.org"

Note: As of February 2021, all new projects began being provisioned on https://s01.oss.sonatype.org/. If your project is not provisioned on https://s01.oss.sonatype.org/, please login to the legacy host https://oss.sonatype.org/.

Is there a way to overwrite the sonatype server url ?

Thanks

steinybot commented 3 years ago

As mentioned in https://github.com/xerial/sbt-sonatype/issues/214 this affects all new Sonatype accounts.

The workaround is to set:

sonatypeCredentialHost := "s01.oss.sonatype.org"
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"

On a multi-project build this must go on the root project. For some strange reason sbt-sonatype is extracting these from the build state rather than using the settings scoped appropriately.

steinybot commented 3 years ago

Sigh... sbt-sonatype is still doing silly things. The above settings enable it to authenticate and create the staging repository but then the actual bundle upload then fails. Perhaps it has to go on every project.

steinybot commented 3 years ago

Fixed in sbt-sonatype 3.9.6 which was just released. Waiting Scala Steward to do its magic and get the blessing from @olafurpg

olafurpg commented 3 years ago

Thank you for reporting! https://github.com/olafurpg/sbt-ci-release/releases/tag/v1.5.6 is out with the upgrade from Scala Steward

mwz commented 3 years ago

It's definitely worth adding a note about this setting to the readme to save people some time searching for it.

mwz commented 3 years ago

FYI there's another hotfix of sbt-sonatype (3.9.7) which fixes the same issue but for snapshots.

@olafurpg would you be able to publish a new release with this update?

sideeffffect commented 3 years ago

I'm using sbt-ci-release and explicitly sbt-sonatype 3.9.7 with

  sonatypeCredentialHost := "s01.oss.sonatype.org",
  sonatypeRepository := "https://s01.oss.sonatype.org/service/local",

It still isn't working, I can't get SNAPSHOT published, I'm getting

java.net.ProtocolException: Server redirected too many  times (20)

What am I doing wrong?

sideeffffect commented 3 years ago

What am I doing wrong?

You, idiot, have been using token credentials from oss.sonatype.org (the old host) the whole time. You are supposed to use token credentials from s01.oss.sonatype.org (the new host).

kubukoz commented 3 years ago

hmm, looks like with 1.5.7 you still have to set sonatypeCredentialHost and sonatypeRepository? Maybe this should be mentioned in the README, as new projects will likely all need to use s01?