Reputation: 49
I'm setting up the config.yml file for CircleCI in my repo in order for it to publish it as a GitHub NPM package.
Before running the npm publish command, we need to authenticate on the GitHub NPM registry using Username, password (Personnal Access Token) and Email.
I have stored those as Environment Variables and can call them with ${PACKAGE_PAT}, ${PACKAGE_ACCOUNT} and ${PACKAGE_EMAIL}.
So now I have 0 clue about how to add these informations in the process, I would really appreciate some help on that please (first time using a CI).
Here's the config file I've set up so far :
version: 2.1
executors:
my-executor:
docker:
- image: circleci/node:10-browsers
working_directory: ~/repo
jobs:
build:
executor: my-executor
steps:
- checkout
- restore_cache:
key: repo-{{ .Branch }}-{{ checksum "package-lock.json" }}
- save_cache:
key: repo-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- 'node_modules'
- run: npm install
- run: npm run build
- run: npm login --registry=https://npm.pkg.github.com/
- run: npm publish
workflows:
version: 2
auto_package_workflow:
jobs:
- build:
filters:
branches:
only:
- /feature\/FRON-1144.*/
Upvotes: 1
Views: 1008
Reputation: 49
I checked and followed the documentation for the npm registry and set my config as this below. Username and email are not necessary. This works great.
- run:
name: Publish to GitHub Packages
command: |
npm set //npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_PAT}
npm publish
Upvotes: 1