I have try many times, but failed, to make an automatic deployment with a workflow (.yml) of my UI project. I can deploy right now with Visual Studio 2022 in the section "Publish", but my goal will be to automate all this. So for the moment I'm focusing on deploying the UI and after I will try the server and the update-database finally. So my yaml files are in the pictures with this post. Here is the output when I click the button "Publish"
Build started at 14:53... 1>------ Build started: Project: HMMetal.UI, Configuration: Release Any CPU ------ 1>HMMetal.UI -> C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\bin\Release\net8.0\HMMetal.UI.dll 1>HMMetal.UI (Blazor output) -> C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\bin\Release\net8.0\wwwroot 1>Done building project "HMMetal.UI.csproj". 2>------ Publish started: Project: HMMetal.UI, Configuration: Release Any CPU ------ HMMetal.UI -> C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\bin\Release\net8.0\HMMetal.UI.dll HMMetal.UI (Blazor output) -> C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\bin\Release\net8.0\wwwroot Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink Optimizing assemblies for size. This process might take a while. C:\Program Files\dotnet\dotnet.exe "C:\Users\Mathd.nuget\packages\microsoft.net.illink.tasks\8.0.3\tools\net8.0\illink.dll" -a "obj\Release\net8.0\HMMetal.UI.dll" EntryPoint --singlewarn --trim-mode link --action copy -reference "C:\Users\Mathd.nuget\packages\anglesharp\1.0.7\lib\net8.0\AngleSharp.dll" ... -reference "C:\Users\Mathd.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\8.0.3\runtimes\browser-wasm\lib\net8.0\mscorlib.dll" -reference "C:\Users\Mathd.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\8.0.3\runtimes\browser-wasm\lib\net8.0\netstandard.dll" -reference "C:\Users\Mathd.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\8.0.3\runtimes\browser-wasm\native\System.Private.CoreLib.dll" -reference "obj\Release\net8.0\HMMetal.UI.dll" --singlewarn- "HMMetal.UI" -out "obj\Release\net8.0\linked" --nowarn "1701;1702;IL2121;1701;1702;2008" --warn "5" --warnaserror- --warnaserror ";NU1605;SYSLIB0011" --feature Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability true --feature System.AggressiveAttributeTrimming true --feature System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization false --feature System.Diagnostics.Debugger.IsSupported false --feature System.Diagnostics.Tracing.EventSource.IsSupported false --feature System.Globalization.Invariant false --feature System.Net.Http.EnableActivityPropagation false --feature System.Reflection.Metadata.MetadataUpdater.IsSupported false --feature System.Reflection.NullabilityInfoContext.IsSupported false --feature System.Resources.ResourceManager.AllowCustomResourceTypes false --feature System.Resources.UseSystemResourceKeys true --feature System.Runtime.InteropServices.BuiltInComInterop.IsSupported false --feature System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting false --feature System.Runtime.InteropServices.EnableCppCLIHostActivation false --feature System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop false --feature System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization false --feature System.StartupHookProvider.IsSupported false --feature System.Text.Encoding.EnableUnsafeUTF7Encoding false --feature System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault true --feature System.Threading.Thread.EnableAutoreleasePool false
--skip-unresolved true --notrimwarn
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\8.0.202\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets..\tools\net8.0\Microsoft.NET.Sdk.StaticWebAssets.Tool.dll" brotli -s "C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\webcil\publish\HMMetal.Models.wasm" -o "C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\compressed\publish\i9iamcgi47.br" -s "C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\webcil\publish\HMMetal.UI.wasm" -o "C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\compressed\publish\bkqp7jt68x.br" -s "obj\Release\net8.0\blazor.publish.boot.json" -o "C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\compressed\publish\zk81ptjwix.br"
Publishing without optimizations. Although it's optional for Blazor, we strongly recommend using
wasm-toolsworkload! You can install it by runningdotnet workload install wasm-toolsfrom the command line. HMMetal.UI -> C:\Users\Mathd\source\repos\HMMetal\HMMetal.UI\obj\Release\net8.0\browser-wasm\PubTmp\Out
Updating file (mathdx-001-site3\wwwroot_framework\blazor.boot.json). Updating file (mathdx-001-site3\wwwroot_framework\blazor.boot.json.br). Updating file (mathdx-001-site3\wwwroot_framework\blazor.boot.json.gz). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.Models.pdb.gz). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.Models.wasm). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.Models.wasm.br). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.Models.wasm.gz). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.UI.pdb.gz). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.UI.wasm). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.UI.wasm.br). Updating file (mathdx-001-site3\wwwroot_framework\HMMetal.UI.wasm.gz). Publish Succeeded. Web App was published successfully http://mathdx-001-site3.etempurl.com/ ========== Build: 1 succeeded, 0 failed, 2 up-to-date, 0 skipped ========== ========== Build completed at 14:53 and took 21,347 seconds ========== ========== Publish: 1 succeeded, 0 failed, 0 skipped ========== ========== Publish completed at 14:53 and took 21,347 seconds ========== Maybe this could help for writting the steps...
For the moment, this is my yaml file that put directly .cs file into HMMetalUI:
name: .NET
on: [push]
# push:
# branches: [ "<your_branch>" ]
# pull_request:
# branches: [ "<your_branch>" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Publish
run: dotnet publish -c release
# - name: Migrate
# run: |
# dotnet tool install --global dotnet-ef
# dotnet ef database update --connection ${{ secrets.CONNECTION_STRING }}
- name: Deploy
run: XXXX
env:
siteName: mathdx-001-site3
serviceUrl: XXXX
username: ${{ secrets.MYASP_USERNAME }}
password: ${{ secrets.MYASP_PASSWORD }}
sourcePath: ${{ github.workspace }}
You can refer to the commented pictures with this post. What is in red is what is doing wrong, what is is green is HMMetalUI (UI project) and state or the expected result when I do the publish.
Can you give me the right .yaml file please? PICTURES:
https://i.stack.imgur.com/U45Nx.png
https://i.stack.imgur.com/nPP8H.png