Problem integrating Codefresh pipeline to publish package in Gitlab Package Registry


I’ve created a Codefresh pipeline to deploy an artifact to Gitlab Package Registry. Source code is also in Gitlab.

I’m able to publish my artifact using a Gitlab Personal Access Token, but when I try to do it using a Gitlab Deploy Token, it fails (401 unauthorized error), no matter if I use Codefresh for it or not.

I have defined this using Gradle, to be able to publish to Gitlab Package Registry:

    repositories {
        maven {
            url "<group_id>/packages/maven"
            credentials(HttpHeaderCredentials) {
                name = "Private-Token"
                value = '<private_token>'
            authentication {

I use the right <group_id> and <private_token> values, they are changed here for security reasons.

If I provide my Personal Access Token in <private_token>, I can publish to Gitlab Package Registry without any problem. But when I use a generated Deploy Token, it fails. Both my Personal Access Token and the Deploy Token have the same name and username (in the case of Deploy Token).

I’m getting a 401 unauthorized error:

* What went wrong:
Execution failed for task ':publishMavenJavaPublicationToMavenRepository'.
> Failed to publish publication 'mavenJava' to repository 'maven'
   > Could not write to resource '<group_id>/packages/maven/mypackageroute/mypackage/0.1/mypackage-0.1.jar'.
      > Could not PUT '<group_id>/packages/maven/mypackageroute/mypackage/0.1/mypackage-0.1.jar'. Received status code 401 from server: Unauthorized

Does anyone know what I’m doing wrong?
Thank you very much