Hi!
I want to publish a private npm package to gitlab local npm registry. I configurated .npmrc files (local & ci) and gitlab-ci.yml. Publishing from local machine works well.
However, when I have tried to do the same on CI I got next error:
Or if I would try yarn (project package manager):
Also, I have tried to use personal access token on CI instead of CI_JOB_TOKEN for test but It didn’t work.
I have followed all steps described in gitlab publishing documentation but I finally got stacked. What are I missing?
I would be grateful for any advice or help. Thanks in advance!
Configs
GitLab version: 13.6.1
gitlab-ci job:
publishing:
stage: publishing
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Publishing.*/
script:
- echo @GeekBrainsTeam:registry=https://gitlab.admin.geekbrains.ru/api/v4/projects/${CI_PROJECT_ID}/packages/npm/ >> .npmrc
- echo //gitlab.admin.geekbrains.ru/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN} >> .npmrc
- docker run --rm ${IMAGE_NAME} yarn build
- docker run --rm ${IMAGE_NAME} yarn version --patch # for example
- docker run --rm ${IMAGE_NAME} npm publish --verbose
Local .npmrc file:
@GeekBrainsTeam:registry=https://gitlab.admin.geekbrains.ru/api/v4/projects/<id>/packages/npm/
//gitlab.admin.geekbrains.ru/api/v4/projects/<id>/packages/npm/:_authToken=<my_token>
//gitlab.admin.geekbrains.ru/api/v4/packages/npm/:_authToken=<my_token>
package.json:
{
"name": "@GeekBrainsTeam/geekbrains-uikit",
"version": "0.1.0",
"description": "React-components library for GeekBrains projects",
"repository": {
"type": "git",
"url": "https://gitlab.admin.geekbrains.ru/GeekBrainsTeam/geekbrains-uikit.git"
},
"publishConfig": {
"access": "restricted",
"directory": "lib",
"@GeekBrainsTeam:registry": "https://gitlab.admin.geekbrains.ru/api/v4/projects/<id>/packages/npm/"
}
...