如何使用circleci

时间:2018-02-24 13:24:01

标签: angular github deployment github-pages circleci

我试图使用此命令

run:
    name: Deploy
    command: |
    git config --global user.email "$GH_EMAIL"
    git config --global user.name "$GH_NAME"
    ./node_modules/.bin/ngh
    echo "Finished Deployment!"

但有错误

An error occurred!
 Error: Unspecified error (run without silent option for detail)
 at /home/circleci/project/node_modules/gh-pages/lib/index.js:232:19
at _rejected (/home/circleci/project/node_modules/q/q.js:844:24)
at /home/circleci/project/node_modules/q/q.js:870:30
at Promise.when (/home/circleci/project/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/circleci/project/node_modules/q/q.js:788:41)
at /home/circleci/project/node_modules/q/q.js:604:44
at runSingle (/home/circleci/project/node_modules/q/q.js:137:13)
at flush (/home/circleci/project/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:150:11)

退出代码1

这是https://www.npmjs.com/package/angular-cli-ghpages

1 个答案:

答案 0 :(得分:0)

我使用以下配置为我的一个项目做了类似的事情:

steps:
  - checkout

  # Download and cache dependencies
  - restore_cache:
      keys:
      - v1-dependencies-{{ checksum "package.json" }}
      # fallback to using the latest cache if no exact match is found
      - v1-dependencies-

  - run: sudo npm install -g @angular/cli@^6.0.0-rc.2
  - run: sudo npm install -g ngh
  - run: npm install

  - save_cache:
      paths:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}

  - run:
      name: Generate Build
      command: ng build --prod --base-href "https://your-name.github.io/your-project-name/"

  - run:
      command: |
        ngh --token $TOKEN

当TOKEN是circlecli环境变量时,其值设置为github token