【问题标题】:How to deploy angular app to github pages using circleci如何使用 circleci 将 Angular 应用程序部署到 github 页面
【发布时间】:2018-08-04 10:11:28
【问题描述】:

我尝试过使用这个命令

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

【问题讨论】:

    标签: angular github deployment github-pages circleci


    【解决方案1】:

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

    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

    【讨论】:

      猜你喜欢
      • 2017-07-30
      • 2020-04-22
      • 2017-07-28
      • 2017-11-03
      • 2019-04-01
      • 1970-01-01
      • 2020-04-23
      • 2019-03-10
      • 1970-01-01
      相关资源
      最近更新 更多