publish-plugin icon indicating copy to clipboard operation
publish-plugin copied to clipboard

Task `initializeSonatypeStagingRepository` fails when using `gradle-setup` action

Open nsenave opened this issue 7 months ago • 14 comments

Hi, thanks for your plugin which helps a lot.

I use the plugin in a GitHub workflow which can be summarized like this:

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        # with: env variables and secrets 
      - uses: gradle/gradle-build-action@v3
      - run: ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository
        # with: env variables and secrets

Works fine.

I've recently replaced gradle/gradle-build-action@v3 (which is deprecated) with gradle/actions/setup-gradle@v3.

Then, I have this error:

Run ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :model:clean UP-TO-DATE

> Task :initializeSonatypeStagingRepository FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':initializeSonatypeStagingRepository'.
2 actionable tasks: 1 executed, 1 up-to-date
> Failed to load staging profiles, server at https://oss.sonatype.org/service/local/ responded with status code 403, body: <html>
    <head>
      <title>403 - Forbidden</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
      <link rel="icon" type="image/png" href="https://oss.sonatype.org/favicon.png">
      <!--[if IE]>
      <link rel="SHORTCUT ICON" href="https://oss.sonatype.org/favicon.ico"/>
      <![endif]-->
  
      <link rel="stylesheet" href="https://oss.sonatype.org/static/css/Sonatype-content.css?2.15.1-02" type="text/css" media="screen" title="no title" charset="utf-8">
    </head>
    <body>
      <h1>403 - Forbidden</h1>
      <p>Forbidden</p>
    </body>
  </html>

Gradle wrapper version used: 8.6

Actions gradle-build-action and actions/setup-gradle are supposed to be functionally identical, so it might be an issue on their side in the end.

Yet, I thought you might have an idea / ways to reproduce the bug and diagnose why the error happens.

nsenave avatar Jul 19 '24 22:07 nsenave