GitHub 操作上的 dotnet 包

dotnet bundle on GitHub Action

我正在尝试 运行 dotnet bundle 在我的 .Net Core 2.1 GitHub 操作上。出现如下错误的操作:

Run cd ./ProjName
  cd ./ProjName
  dotnet bundle
  shell: /bin/bash -e {0}
  env:
    DOTNET_ROOT: /home/runner/.dotnet
No executable found matching command "dotnet-bundle"

该项目正在使用 BundlerMinifierCore 进行缩小。当命令为 运行.

时,这应该构建缩小文件

我对 GitHub 操作还很陌生,正在习惯引入项目构建所需的一切。我是否缺少 .Net CLI 工具或类似工具?

YAML如下:

name: Build and Deploy Develop

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 2.1.x
    - name: Restore dependencies
      run: |
        cd ./ProjName
        dotnet restore
    - name: Build
      run:  |
        cd ./ProjName
        dotnet build --no-restore
    - name: Bundle JS and CSS Assets
      run:  |
        cd ./ProjName
        dotnet bundle
    - name: Test
      run:   |
        cd ./ProjName
        dotnet test --no-build --verbosity normal
    - name: Build Linux
      run:  |
        cd ./ProjName
        dotnet publish -c Release --self-contained true --runtime linux-x64 --framework netcoreapp2.1 /p:useapphost=true
    - name: Copy Files to Develop
      uses: garygrossgarten/github-action-scp@release
      with:
        local: ./ProjName/ProjName.WebApp/bin/Release/netcoreapp2.1/linux-x64/publish
        remote: /home/deploy/ProjName/develop/staging
        host: ${{ secrets.DEPLOY_SERVER }}
        username: deploy
        port: 22509
        privateKey: ${{ secrets.SSH_PRIVATE_KEY }}
    - name: Call deploy.sh on Server
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.DEPLOY_SERVER }}
        port: 22509
        username: deploy
        key: ${{ secrets.SSH_PRIVATE_KEY }}
        script: "sudo /var/aspnetcore/ProjName/develop/deploy.sh"

您似乎在尝试使用 dotnet bundle 工具而不安装它。

请尝试在安装 .NET 后安装它。像这样:

    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 2.1.x
    # only this is new
    - name: Install dotnet tools
      run: |
        dotnet tool install -g BundlerMinifier.Core
    - name: Restore dependencies
      run: |
        cd ./ProjName
        dotnet restore