【问题标题】:Github Actions Angular-cliGithub Actions Angular-cli
【发布时间】:2020-04-15 09:28:56
【问题描述】:

已创建一个项目并将其放置在 Github 上。我试图通过构建 Angular-cli 项目来探索 Github Actions。

githubAction的.yml文件如下,

  steps:
        - uses: actions/checkout@v1
        - name: Install NPM
          run:  npm install
        - name: Update Npm
          run:  npm update
        - name: Typescript compiler
          uses: iCrawl/action-tsc@v1
        - name: NpM angular CLI 
          uses: npm install angular-cli
        - name: Build
          run:  npm build

然后在构建时出现以下错误,

The pipeline is not valid. .github/workflows/main.yml (Line: 19, Col: 13): Expected format {org}/{repo}[/path]@ref. Actual 'npm install angular-cli',Input string was not in a correct format.

【问题讨论】:

    标签: github github-actions


    【解决方案1】:

    您似乎是 Github 操作和部署的新手。 以我的经验,我假设您已经到了安装 Angular-CLI 的地步,因为在操作流程中出现了 ng not found 问题。

    - uses: actions/checkout@v1
    - name: Install Node
      uses: actions/setup-node@v1
         with:
            node-version: 12.8
    - name: npm dependencies
       run: npm install     
    - name: Build
       run: npm run build -- --prod
    

    修复细节:先安装 Node,然后尝试 npm install 和 npm build

    【讨论】:

      【解决方案2】:

      我使用市场上的Angular Deploy gh-pages Actions GitHub 操作在 GitHub 中设置 Angular。

      这是我的main.yml 文件

      name: Host Angular app in GitHub 
      on:
        push:
          branches:
            - master
      jobs:
        build:
          runs-on: ubuntu-latest
          steps:
          - uses: actions/checkout@v2
          - name: Building and Deploying...
            uses: AhsanAyaz/angular-deploy-gh-pages-actions@v1.3.1 
            with:
              github_access_token: ${{ secrets.ACCESS_TOKEN }} 
              build_configuration: production 
              base_href: /shopping-cart/  
              deploy_branch: gh-pages 
              angular_dist_build_folder: dist/shopping-cart 
      

      这里是detailed steps,用于在 GitHub 中设置 Angular 应用程序。

      分步说明here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-11-30
        • 2021-03-01
        • 2022-10-05
        • 2020-01-14
        • 1970-01-01
        • 2021-08-30
        • 2020-09-06
        • 1970-01-01
        相关资源
        最近更新 更多