Home>

I want to publish my library via gitlab Tried doing this

maven {
                url "https://******/api/v4/projects/***/packages/maven"
                credentials(HttpHeaderCredentials) {
                    name= "Deploy-Token"
                    value= DEPLOY_TOKEN
                }
                authentication {
                    header(HttpHeaderAuthentication)
                }
            }

But this is with the command from.gitlab-ci.yml

deployLib:
  stage: deploy
  script:
    -./gradlew publish
  only:
    -develop

Provided an error

Execution failed for task ':auth:publishReleaseAarPublicationToMavenRepository'.
> Failed to publish publication 'releaseAar' to repository 'maven'
   > Could not PUT 'https://****/api/v4/projects/***/packages/maven/org/****/***/auth/1.0.0-beta/auth-1.0. 0-beta.aar'. Received status code 404 from server: Not Found

Found on one source that you need to add not Deploy-token but Job-Token

maven {
                url "${CI_API_V4_URL}/groups/***/packages/maven"
                credentials(HttpHeaderCredentials) {
                    name= 'Job Token'
                    value= System.getenv("CI_JOB_TOKEN")
                }
                authentication {
                    header(HttpHeaderAuthentication)
                }
            }

Now the code looks like this, but I can't even figure out where to get it from the docksCI_JOB_TOKENandCI_API_V4_URLtell me either in a word or a link to a suitable article, what is wrong, do not criticize too much, for the first time I am publishing my lib

You don't need to take it. When a pipeline job is about to run, GitLab generates a unique token and injects it as the CI_JOB_TOKEN predefined variable. docs.gitlab.com/ee/ci/jobs/ci_job_token.html

Eugene Krivenja2022-01-18 13:43:53

There are a lot of interesting things about GitLab variables here: docs.gitlab.com/ee/ci/variables

Eugene Krivenja2022-01-18 13:45:44

What about CI_API_V4_URL?

Svetl9chok2022-01-18 13:47:18

dox.gitlab.com/her/ki/variables/#enable-debug-logging

Eugene Krivenja2022-01-18 13:49:16