Github 操作 Angular-cli

Github Actions Angular-cli

项目已创建并放置在 Github。我试图通过构建 Angular-cli 项目来探索 Github 操作。

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 操作和部署方面的新手。 根据我的经验,我假设你已经到了安装 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

我已使用市场中的 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