Skip to content

Publish to NuGet

Publish to NuGet #65

Workflow file for this run

name: Publish to NuGet
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
nuGetVersionNumber: 5.2.2
nuGetFullVersionNumber: 5.2.2.${{ github.run_number }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
# this is fixed to just one version so we only run the push operation once
dotnet-version: [ '7.0.x' ]
steps:
- name: Checkout Code
uses: actions/checkout@v1
- name: Setup dotnet CLI
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
- name: Setup dependencies caching
uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Prepare Legacy NuGet
run: |
cd .\.nuget
ren NuGet.ex_ NuGet.exe
cd ..
.nuget\NuGet.exe restore Cqrs.sln
- name: Build Framework with dotnet CLI
run: dotnet build --configuration Release .\Cqrs.sln
- name: Pack with dotnet CLI
run: |
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Cqrs\Cqrs.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\DependencyInjection\Cqrs.DependencyInjection\Cqrs.DependencyInjection.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\DependencyInjection\Azure\Cqrs.DependencyInjection.Azure.ServiceBus.CommandBus\Cqrs.DependencyInjection.Azure.ServiceBus.CommandBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\DependencyInjection\Azure\Cqrs.DependencyInjection.Azure.ServiceBus.EventBus\Cqrs.DependencyInjection.Azure.ServiceBus.EventBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\DependencyInjection\Azure\Cqrs.DependencyInjection.Azure.Storage\Cqrs.DependencyInjection.Azure.Storage.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.ConfigurationManager\Cqrs.Azure.ConfigurationManager.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.ServiceBus\Cqrs.Azure.ServiceBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.EventHub\Cqrs.Azure.EventHub.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.Storage\Cqrs.Azure.Storage.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.KeyVault\Cqrs.Azure.KeyVault.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.Functions\Cqrs.Azure.Functions.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.Functions.Isolated\Cqrs.Azure.Functions.Isolated.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.Functions.ServiceBus\Cqrs.Azure.Functions.ServiceBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.Functions.ServiceBus.Isolated\Cqrs.Azure.Functions.ServiceBus.Isolated.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Cqrs.Web.Mvc\Cqrs.Web.Mvc.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Cqrs.WebApi\Cqrs.WebApi.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\Cqrs.Azure.WebJobs\Cqrs.Azure.WebJobs.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.EventHub.CommandBus\Cqrs.Ninject.Azure.EventHub.CommandBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.EventHub.EventBus\Cqrs.Ninject.Azure.EventHub.EventBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.ServiceBus.CommandBus\Cqrs.Ninject.Azure.ServiceBus.CommandBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.ServiceBus.EventBus\Cqrs.Ninject.Azure.ServiceBus.EventBus.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.Storage\Cqrs.Ninject.Azure.Storage.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.Wcf\Cqrs.Ninject.Azure.Wcf.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Azure\Cqrs.Ninject.Azure.WebJobs\Cqrs.Ninject.Azure.WebJobs.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Cqrs.Ninject\Cqrs.Ninject.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Cqrs.Ninject.ServiceHost\Cqrs.Ninject.ServiceHost.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Ninject\Cqrs.Ninject.WebApi\Cqrs.Ninject.WebApi.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Framework\Azure\EnterpriseLibrary.Azure.TransientFaultHandling.ServiceBus.NetCore\_EnterpriseLibrary.Azure.TransientFaultHandling.ServiceBus.NetCore.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Scheduler\Cqrs.Scheduler.Commands\Cqrs.Scheduler.Commands.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
dotnet pack -c Release -property:SolutionDir=.\ -p:Version=${{ env.nuGetVersionNumber }} Scheduler\Cqrs.Scheduler.Events\Cqrs.Scheduler.Events.csproj -p:PackageVersion=${{ env.nuGetFullVersionNumber}} --include-symbols -p:SymbolPackageFormat=snupkg --include-source -o Packaged
- name: Push with dotnet CLI
run: |
.nuget\NuGet.exe source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/cdmdotnet/index.json" -UserName cdmdotnet -Password ${{ secrets.NUGET_PUBLISH_TOKEN }}
.nuget\NuGet.exe setapikey ${{ secrets.NUGET_PUBLISH_TOKEN }} -Source "https://nuget.pkg.github.com/cdmdotnet/index.json"
dotnet nuget push Packaged\*.nupkg -k ${{ secrets.NUGET_PUBLISH_TOKEN }} -s https://api.nuget.org/v3/index.json
tag:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Bump version and push release
id: tag_version
uses: mathieudutour/github-tag-action@v5.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: releases/${{ env.nuGetVersionNumber }}/${{ env.nuGetFullVersionNumber}}
tag_prefix:
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}