【问题标题】:dotnet bundle on GitHub ActionGitHub Action 上的 dotnet 包
【发布时间】:2021-04-25 06:54:18
【问题描述】:

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

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 工具?可以分享一下工作流 yaml 文件吗?
  • @omajid 不,我没有。
  • 好的,包括 YAML。

标签: asp.net-core .net-core github-actions dotnet-cli dotnet-bundle


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-06
    • 2020-01-02
    • 2020-07-26
    • 2023-03-14
    • 1970-01-01
    • 2023-02-14
    • 2023-02-15
    • 2020-02-01
    相关资源
    最近更新 更多