我正在回购中为CircleCI设置config.yml文件,以便将其发布为GitHub NPM软件包。
在运行npm publish命令之前,我们需要使用用户名,密码(个人访问令牌)和电子邮件在GitHub NPM注册表上进行身份验证。
我已经将它们存储为环境变量,可以使用$ {PACKAGE_PAT},$ {PACKAGE_accOUNT}和$ {PACKAGE_EMAIL}来调用它们。
因此,现在我对如何在此过程中添加这些信息有0条线索,对此,我真的很感谢(首次使用CI)一些帮助。
这是我到目前为止设置的配置文件:
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.*/