# ASP.NET Core # Build and test ASP.NET Core projects targeting .NET Core. # Add steps that run tests, create a NuGet package, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core trigger: - master pr: - none pool: vmImage: 'windows-latest' name: 'This is changed in a task, below' variables: projectName: 'Gameboard.ShogiUI.Sockets' version.MajorMinor: '1.0' # Manually change this when needed to follow semver. version.Patch: $[counter(variables['version.MajorMinor'], 0)] versionNumber: '$(version.MajorMinor).$(version.Patch)' steps: - task: PowerShell@2 displayName: Set the name of the build (i.e. the Build.BuildNumber) inputs: targetType: 'inline' script: | [string] $buildName = "$(versionNumber)_$(Build.SourceBranchName)" Write-Host "Setting the name of the build to '$buildName'." Write-Host "##vso[build.updatebuildnumber]$buildName" - task: NuGetToolInstaller@1 - task: NuGetCommand@2 inputs: command: 'restore' restoreSolution: '**/*.sln' feedsToUse: 'config' - task: DotNetCoreCLI@2 displayName: Publish env : DOTNET_CLI_TELEMETRY_OPTOUT: 1 inputs: command: 'publish' publishWebProjects: false projects: '**/*.csproj' zipAfterPublish: false arguments: '-c Release' - task: FileTransform@1 inputs: folderPath: '$(System.DefaultWorkingDirectory)' fileType: 'json' targetFiles: '**/appsettings.json' - task: CopyFilesOverSSH@0 displayName: SSH Copy to 1UB inputs: sshEndpoint: 'LucaServer' sourceFolder: '$(System.DefaultWorkingDirectory)\$(projectName)\bin\Release\net6.0\publish' targetFolder: '/var/www/apps/$(projectName)' contents: '**' failOnEmptySource: true cleanTargetFolder: true - task: SSH@0 displayName: Restart Kestrel inputs: sshEndpoint: 'LucaServer' runOptions: 'commands' commands: 'sudo systemctl restart kestrel-gameboard.shogiui.sockets.service' readyTimeout: '20000' - task: NuGetCommand@2 inputs: command: 'pack' packagesToPack: '**/*.ServiceModels/*.csproj' versioningScheme: 'byBuildNumber' - task: NuGetCommand@2 displayName: 'Push Nuget to Feed' inputs: command: 'push' packagesToPush: '$(Build.DefaultWorkingDirectory)/**/*.nupkg;!$(Build.DefaultWorkingDirectory)/**/*.symbols.nupkg' nuGetFeedType: 'internal' publishVstsFeed: '5622b603-b328-44aa-a6e8-8ca56ff54f88/22948853-baa7-4774-b19d-3aed351711c7'