1- # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
1+ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
22name : publish
33on :
44 workflow_dispatch : # Allow running the workflow manually from the GitHub UI
99env :
1010 DOTNET_SKIP_FIRST_TIME_EXPERIENCE : 1
1111 DOTNET_NOLOGO : true
12- PROJECT_NAME : OpenAC.Net.DFe.Core
1312 NuGetDirectory : ${{ github.workspace }}/nuget
1413
1514defaults :
@@ -24,25 +23,32 @@ jobs:
2423 with :
2524 fetch-depth : 0 # Get all history to allow automatic versioning using MinVer
2625
27- - name : Setup NuGet
28- uses : nuget/setup-nuget@v2
29-
30- - name : Restore NuGet packages
31- run : nuget restore ${{ env.PROJECT_NAME }}.sln
32- working-directory : src
33-
3426 # Install the .NET SDK indicated in the global.json file
3527 - name : Setup .NET
36- uses : actions/setup-dotnet@v4
28+ uses : actions/setup-dotnet@v5.0.0
3729 with :
38- dotnet-version : ' 8.x'
39- - run : dotnet msbuild ${{ env.PROJECT_NAME }}.sln -property:Configuration=Release -property:platform="Any CPU"
30+ dotnet-version : |
31+ 8.x
32+ 9.x
33+ 10.x
34+
35+ - name : Setup NuGet
36+ uses : nuget/setup-nuget@v2.0.1
37+
38+ - name : Restore NuGet packages
39+ run : nuget restore OpenAC.Net.DFe.Core.sln
4040 working-directory : src
41- - run : dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
41+
42+ - name : Build solution
43+ run : dotnet msbuild OpenAC.Net.DFe.Core.sln -property:Configuration=Release -property:platform="Any CPU"
4244 working-directory : src
4345
46+ - name : Pack NuGet package
47+ run : dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
48+ working-directory : src
49+
4450 # Publish the NuGet package as an artifact, so they can be used in the following jobs
45- - uses : actions/upload-artifact@v4
51+ - uses : actions/upload-artifact@v5
4652 with :
4753 name : nuget
4854 if-no-files-found : error
@@ -55,10 +61,10 @@ jobs:
5561 steps :
5662 # Install the .NET SDK indicated in the global.json file
5763 - name : Setup .NET
58- uses : actions/setup-dotnet@v4
64+ uses : actions/setup-dotnet@v5
5965
6066 # Download the NuGet package created in the previous job
61- - uses : actions/download-artifact@v4
67+ - uses : actions/download-artifact@v6
6268 with :
6369 name : nuget
6470 path : ${{ env.NuGetDirectory }}
7379 - name : Validate package
7480 run : meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
7581
76- deploy :
82+ publish_nuget :
7783 # Publish only when creating a GitHub Release
7884 # https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
7985 # You can update this logic if you want to manage releases differently
@@ -98,4 +104,15 @@ jobs:
98104 run : |
99105 foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
100106 dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
101- }
107+ }
108+
109+ webhook :
110+ runs-on : ubuntu-latest
111+ needs : [ publish_nuget ]
112+ env :
113+ DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK_URL }}
114+ steps :
115+ - name : Discord notification
116+ uses : Ilshidur/action-discord@0.4.0
117+ with :
118+ args : ' Uma nova versão do **OpenAC.Net.DFe.Core** foi publicada! Confira agora em [NuGet.org](https://www.nuget.org/packages/OpenAC.Net.DFe.Core).'
0 commit comments