Publish to Nuget #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Nuget | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| publish_functions_pkg: | |
| type: boolean | |
| default: false | |
| description: "Publish Functions package" | |
| package_source: | |
| type: string | |
| default: "https://api.nuget.org/v3/index.json" | |
| description: "NuGet package source" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: 🛠Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.x | |
| - name: 🧾 Create local nuget.config | |
| run: | | |
| echo '<?xml version="1.0" encoding="utf-8"?> | |
| <configuration> | |
| <packageSources> | |
| <clear /> | |
| <add key="local" value="nupkgs" /> | |
| <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | |
| </packageSources> | |
| </configuration>' > nuget.config | |
| - name: 📦 Pack CommunityFabs.NET.Common | |
| run: | | |
| dotnet pack ./CommunityFabs.NET.Common/CommunityFabs.NET.Common.csproj -c Release -o ./nupkgs | |
| - name: 📦 Pack CommunityFabs.NET.Instance | |
| run: | | |
| dotnet restore ./CommunityFabs.NET.Instance/CommunityFabs.NET.Instance.csproj --configfile nuget.config | |
| dotnet pack ./CommunityFabs.NET.Instance/CommunityFabs.NET.Instance.csproj -c Release -o ./nupkgs | |
| - name: 📦 Pack CommunityFabs.NET.Functions | |
| if: ${{ github.event.inputs.publish_functions_pkg == 'true' }} | |
| run: | | |
| dotnet restore ./CommunityFabs.NET.Functions/CommunityFabs.NET.Functions.csproj --configfile nuget.config | |
| dotnet pack ./CommunityFabs.NET.Functions/CommunityFabs.NET.Functions.csproj -c Release -o ./nupkgs | |
| - name: 🎉 Publish Common & Instance | |
| run: | | |
| dotnet nuget push ./nupkgs/CommunityFabs.NET.Common.*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ github.event.inputs.package_source }} | |
| dotnet nuget push ./nupkgs/CommunityFabs.NET.Instance.*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ github.event.inputs.package_source }} | |
| - name: 🎉 Publish Functions | |
| if: ${{ github.event.inputs.publish_functions_pkg == 'true' }} | |
| run: | | |
| dotnet nuget push ./nupkgs/CommunityFabs.NET.Functions.*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source ${{ github.event.inputs.package_source }} |