Azure YAML Pipelines for NuGet publish for internal use
YAML file from my Company Tech Formats
name: $(majorMinorVersion).$(semanticVersion)
trigger:
- none
resources:
repositories:
- repository: RepoNameHere
type: git
name: NameItAsYouWish
ref: main
trigger:
branches:
include:
- main
pool:
vmImage: ubuntu-latest
variables:
majorMinorVersion: 1.0.0
# semanticVersion counter is automatically incremented by one in each pipeline execution
# second parameter is a seed value, resets when referenced majorMinorVersion is changed
semanticVersion: $[counter(variables['majorMinorVersion'], 0)]
jobs:
- job: PublishToNuGetfeed
displayName: Publish to NuGet feed
steps:
- template: NugetPublish.yml
parameters:
LibraryProject: ProjectNameToBuild
PublishFeed: FeedToPublishTo
parameters:
- name: LibraryProject
displayName: Full Library Project Name
type: string
- name: PublishFeed
displayName: Feed To Publish To
type: string
steps:
- checkout: git://YourProjectName/${{ parameters.LibraryProject }}
- task: UseDotNet@2
displayName: 'Install .NET 9.x'
inputs:
packageType: 'sdk'
version: '9.x'
- task: DotNetCoreCLI@2
displayName: 'Create NuGet Package'
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'byBuildNumber'
- task: NuGetCommand@2
displayName: 'Publish ver $(majorMinorVersion).$(semanticVersion)'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '${{ parameters.PublishFeed }}'