Hi!
At the moment I use codebuild for my CI/CD pipeline and want to change it to serverless framework if it is possible. But running into a problem with my private github package.
I want a secure way to put my token to my github package.
At the moment in codebuild:
I have the github token as a environment variable and in my buildspec file i run
echo "//npm.pkg.github.com/:_authToken=$NPM_TOKEN" > ~/.npmrc
before the
yarn install
i have tried to run that script in preinstall in package.json while also having the NPM_TOKEN in deployment profile parameters:
"scripts": {
"preinstall": "echo '//npm.pkg.github.com/:_authToken=$NPM_TOKEN' > ~/.npmrc"
},
But i get:
build step: yarn install
yarn install v1.22.4
$ echo '//npm.pkg.github.com/:_authToken=$NPM_TOKEN' > ~/.npmrc
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred Request failed \"401 Unauthorized\""
I want the token in “deployment profile parameters”, but can’t “inject” it somewhere to make it work with yarn install. Anyone know any solution or have any workaround?