-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
# ASP.NET | ||
# Build and test ASP.NET projects. | ||
# Add steps that publish symbols, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 | ||
|
||
trigger: | ||
- master | ||
|
||
pool: | ||
vmImage: 'windows-latest' | ||
vmImage: 'windows-2019' | ||
|
||
variables: | ||
solution: '**/*.sln' | ||
buildPlatform: 'Any CPU' | ||
buildConfiguration: 'Release' | ||
Prerelease: '' | ||
buildId: "1$(Build.BuildId)" | ||
buildProjects: '**/src/**/*.csproj' | ||
|
||
steps: | ||
- task: NuGetToolInstaller@1 | ||
# Print buildId | ||
- script: | | ||
echo "BuildId = $(buildId)" | ||
displayName: 'Print buildId' | ||
|
||
# Based on https://whereslou.com/2018/09/versioning-and-publishing-nuget-packages-automatically-using-azure-devops-pipelines/ | ||
- task: DotNetCoreCLI@2 | ||
displayName: Build Release | ||
inputs: | ||
command: 'build' | ||
arguments: /p:Configuration=Release # https://github.com/MicrosoftDocs/vsts-docs/issues/1976 | ||
projects: $(buildProjects) | ||
|
||
- task: NuGetCommand@2 | ||
- task: DotNetCoreCLI@2 | ||
displayName: Pack | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
restoreSolution: '$(solution)' | ||
command: pack | ||
configuration: 'Release' | ||
packagesToPack: $(buildProjects) | ||
nobuild: true | ||
packDirectory: '$(Build.ArtifactStagingDirectory)/packages' | ||
verbosityPack: 'normal' | ||
|
||
- task: VSBuild@1 | ||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish Artifacts | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
solution: '$(solution)' | ||
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' | ||
platform: '$(buildPlatform)' | ||
configuration: '$(buildConfiguration)' | ||
PathtoPublish: '$(Build.ArtifactStagingDirectory)' | ||
|
||
- task: VSTest@2 | ||
- task: DotNetCoreCLI@2 | ||
displayName: Push to NuGet | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests | ||
inputs: | ||
platform: '$(buildPlatform)' | ||
configuration: '$(buildConfiguration)' | ||
command: custom | ||
custom: nuget | ||
arguments: push $(Build.ArtifactStagingDirectory)\packages\*.nupkg -n true -s https://api.nuget.org/v3/index.json -k $(NuGetKey) |