Github动作Angular-cli

时间:2019-12-24 09:08:53

标签: github github-actions

已创建一个项目并将其放置在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.

2 个答案:

答案 0 :(得分:1)

您似乎在Github Actions和部署中是新手。 根据我的经验,我认为您已经安装Angular-CLI,原因是未发现操作流程中出现了问题。

- 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

答案 1 :(得分:0)

我使用了市场上的 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 

以下是用于在 GitHub 中设置 Angular 应用程序的 detailed steps

分步说明here