diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1355b2e..1a323e7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,92 +1,64 @@ -# 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 +# 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 -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)' + solution: '**/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + apiProjectName: 'Shogi.Api' + uiProjectName: 'Shogi.UI' steps: -# https://github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md#build-logging-commands -- task: PowerShell@2 - displayName: Set the name of the build (i.e. the Build.BuildNumber) - inputs: - targetType: 'inline' - script: | - [string] $buildName = "$(versionNumber)" - 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' + restoreSolution: '$(solution)' - task: FileTransform@1 inputs: - folderPath: '$(System.DefaultWorkingDirectory)' + folderPath: '$(System.DefaultWorkingDirectory)\$(uiProjectName)' fileType: 'json' - targetFiles: '**/appsettings.json' + targetFiles: 'wwwroot/appsettings.json' + +- task: DotNetCoreCLI@2 + inputs: + command: 'publish' + publishWebProjects: false + arguments: '-c Release' + zipAfterPublish: false - task: CopyFilesOverSSH@0 - displayName: SSH Copy to 1UB + displayName: "Copy API files." inputs: sshEndpoint: 'LucaServer' - sourceFolder: '$(System.DefaultWorkingDirectory)\$(projectName)\bin\Release\net6.0\publish' - targetFolder: '/var/www/apps/$(projectName)' + sourceFolder: '$(System.DefaultWorkingDirectory)/$(apiProjectName)/bin/Release/net6.0/publish' contents: '**' - failOnEmptySource: true - cleanTargetFolder: true + targetFolder: '/var/www/apps/$(apiProjectName)' + readyTimeout: '20000' + +- task: CopyFilesOverSSH@0 + displayName: "Copy UI files." + inputs: + sshEndpoint: 'LucaServer' + sourceFolder: '$(System.DefaultWorkingDirectory)/$(uiProjectName)/bin/Release/net6.0/publish' + contents: '**' + targetFolder: '/var/www/apps/$(uiProjectName)' + readyTimeout: '20000' - task: SSH@0 - displayName: Restart Kestrel + displayName: "Restart Kestrel" inputs: sshEndpoint: 'LucaServer' runOptions: 'commands' - commands: 'sudo systemctl restart kestrel-gameboard.shogiui.sockets.service' - readyTimeout: '20000' - -- task: DotNetCoreCLI@2 - displayName: 'Pack ServiceModels' - inputs: - command: 'pack' - packagesToPack: '**/*ServiceModels*.csproj' - versioningScheme: byBuildNumber - arguments: '-c Release' - -- task: DotNetCoreCLI@2 - displayName: 'Push NuGet packages to Feed' - inputs: - command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' - nuGetFeedType: 'internal' - publishVstsFeed: '5622b603-b328-44aa-a6e8-8ca56ff54f88/22948853-baa7-4774-b19d-3aed351711c7' \ No newline at end of file + commands: 'sudo systemctl restart kestrel-shogi.api.service' + readyTimeout: '20000' \ No newline at end of file