首页 > 解决方案 > 在 github 页面上尝试使用 github 操作部署 Blazor(操作失败,并显示“ENOENT:没有这样的文件或目录,scandir)

问题描述

我已经按照本教程https://www.meziantou.net/publishing-a-blazor-webassembly-application-to-github-pages.htm并在 github 的过程中产生了这个错误: 错误 Github Action

这是 github 操作文件:

name: 'Publish application'
on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
        # Checkout the code
        - uses: actions/checkout@v2

        # Install .NET Core SDK
        - name: Setup .NET Core
          uses: actions/setup-dotnet@v1
          with:
            dotnet-version: 3.1.x

        # Run tests
        - name: Test
          run: dotnet test
        
        # DotNet restore
        - name: DotNet restore
          run: dotnet restore

        # Generate the website
        - name: Publish
          run: dotnet publish GSS.MyDotNetPortfolio.Presentation/GSS.MyDotNetPortfolio.Presentation.csproj --configuration Release

        # Publish the website
        - name: GitHub Pages action
          if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
          uses: peaceiris/actions-gh-pages@v3.6.1
          with:
            github_token: ${{ secrets.PUBLISH_TOKEN }}
            publish_branch: gh-pages
            publish_dir: bin/Release/netstandard2.1/publish/wwwroot
            allow_empty_commit: false
            keep_files: false
            force_orphan: true
            # TODO uncomment the following line if you have a custom domain name
            # cname: demo.meziantou.net

这是我的 .gitignore 文件: https ://github.com/guillem-soler-suetta/GSS.MyDotNetPortfolio/blob/master/.gitignore

有任何想法吗?我做了一些研究,也许是用于构建项目的块状包的问题。

谢谢。

标签: c#.netgithubblazorgithub-actions

解决方案


name: gh-pages

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.1.301
    - name: Publish with dotnet
      run: dotnet publish **projectName/projectName.csproj** --configuration Release --output build
    - name: Deploy to Github Pages
      uses: JamesIves/github-pages-deploy-action@releases/v3
      with:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        BASE_BRANCH: master # The branch the action should deploy from.
        BRANCH: gh-pages # The branch the action should deploy to.
        FOLDER: build/wwwroot # The folder the action should deploy.
        SINGLE_COMMIT: true

将项目名称更改为您的并尝试。来自一个网站,不知道是否可以在这里给出归属。它对我有用。


推荐阅读