尝试发布 Blazor WASM 应用,但单声道运行时和类库不同步



>描述错误

我正在尝试使用 GitHub Actions 将 blazor wasm 应用程序发布到 GitHub Pages 和 aliyun oss。 部署成功,但在浏览器上出现错误,请参阅控制台日志。 我做错了什么?

我的网络

name: deploy to web
on:
push:
paths: 
- 'src/Orion.UI.Web/**'
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: setup dotnet core
uses: actions/setup-dotnet@master
with:
dotnet-version: 3.1.100
- name: setup aliyun oss
uses: manyuanrong/setup-ossutil@master
with:
endpoint: oss-cn-hangzhou.aliyuncs.com
access-key-id: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
- name: build
run: dotnet publish ./src/Orion.UI.Web/Orion.UI.Web.csproj -c Release -o ./bin/publish
- name: deploy to aliyun oss
run: ossutil cp -rf ./bin/publish/Orion.UI.Web/dist oss://gohopo-orion/
- name: deploy to github pages
uses: peaceiris/actions-gh-pages@master
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_PAGES_TOKEN }}
EXTERNAL_REPOSITORY: gohopo/gohopo.github.io
PUBLISH_BRANCH: master
PUBLISH_DIR: ./bin/publish/Orion.UI.Web/dist

操作结果: 图片网址

浏览器上的错误: 图片网址

要重现

我的 .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.1.0-preview4.19579.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview4.19579.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.1.0-preview4.19579.2" PrivateAssets="all" />
</ItemGroup>
</Project>

更多技术细节

  • Microsoft.AspNetCore.Blazor 3.1.0-preview4.19579.2
  • dotnet 版本:3.1.100
  • GitHub 操作构建

您的网站现在看起来不错,但是关于 GitHub 操作工作流存在一些错误和更新,我留下了一个示例工作流。

这是 Hugo 的工作流程。

有关更多选项和用法,请参阅最新的自述文件:peaceiris/actions-gh-pages:GitHub Actions for GitHub Pages

  • 设置on.push.branches以触发具有特定分支(如mainmaster(的工作流。
  • 设置特定的操作标记,而不是@master
name: github pages
on:
push:
branches:
- main  # Set a branch name to trigger deployment
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: build-someting
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: your-branch  # default: gh-pages

相关内容

  • 没有找到相关文章

最新更新