-1

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

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"
4

1 回答 1

1

看起来您正在尝试使用该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
于 2021-01-20T21:20:56.357 回答