11# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
22
3- name : publish
3+ name : CD
44on :
5- workflow_dispatch :
6- push :
7- branches :
8- - ' main'
9- - ' master'
10- pull_request :
11- branches :
12- - ' *'
135 release :
146 types :
157 - published
@@ -24,7 +16,7 @@ defaults:
2416 shell : pwsh
2517
2618jobs :
27- create_nuget :
19+ publish-nuget :
2820 runs-on : ubuntu-latest
2921 steps :
3022 - uses : actions/checkout@v4
@@ -45,32 +37,17 @@ jobs:
4537 - name : Test
4638 run : dotnet test --configuration Release --no-build --verbosity normal
4739
48- - name : Pack NuGet Packages
40+ - name : Pack NuGet Package
4941 run : dotnet pack src/BlazorFrame/BlazorFrame.csproj --configuration Release --output ${{ env.NuGetDirectory }} --no-build
5042
5143 - uses : actions/upload-artifact@v4
5244 with :
53- name : nuget
45+ name : nuget-package
5446 if-no-files-found : error
55- retention-days : 7
47+ retention-days : 30
5648 path : ${{ env.NuGetDirectory }}/*.nupkg
5749
58- deploy :
59- if : github.event_name == 'release'
60- runs-on : ubuntu-latest
61- needs : [ create_nuget ]
62- steps :
63- - uses : actions/download-artifact@v4
64- with :
65- name : nuget
66- path : ${{ env.NuGetDirectory }}
67-
68- - name : Setup .NET
69- uses : actions/setup-dotnet@v4
70- with :
71- dotnet-version : ' 8.0.x'
72-
73- - name : Publish NuGet package
50+ - name : Publish to NuGet
7451 run : |
7552 foreach ($file in Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg) {
7653 if ($file.Name -like "BlazorFrame.*.nupkg") {
8057 --source https://api.nuget.org/v3/index.json `
8158 --skip-duplicate
8259 }
83- }
60+ }
61+
62+ - name : Create GitHub Release Asset
63+ run : |
64+ foreach ($file in Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg) {
65+ if ($file.Name -like "BlazorFrame.*.nupkg") {
66+ gh release upload ${{ github.event.release.tag_name }} $file
67+ }
68+ }
69+ env :
70+ GH_TOKEN : ${{ github.token }}
0 commit comments