diff --git a/Tailspin.SpaceGame.Web/Controllers/HomeController.cs b/Tailspin.SpaceGame.Web/Controllers/HomeController.cs index fd63497f3..d6d5a53f5 100644 --- a/Tailspin.SpaceGame.Web/Controllers/HomeController.cs +++ b/Tailspin.SpaceGame.Web/Controllers/HomeController.cs @@ -134,4 +134,4 @@ public IActionResult Error() return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } -} +} \ No newline at end of file diff --git a/Tailspin.SpaceGame.Web/Startup.cs b/Tailspin.SpaceGame.Web/Startup.cs index 659297b46..fe0643791 100644 --- a/Tailspin.SpaceGame.Web/Startup.cs +++ b/Tailspin.SpaceGame.Web/Startup.cs @@ -67,4 +67,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) }); } } -} +} \ No newline at end of file diff --git a/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml b/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml index f7c4c8860..a3fab7778 100644 --- a/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml +++ b/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml @@ -5,7 +5,7 @@ - An example site for learning + Where does this show up? Hopefully Test Slot only! @@ -267,4 +267,4 @@ - \ No newline at end of file + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..dd9464bdc --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,185 @@ +trigger: +- none + +variables: + buildConfiguration: 'Release' + +stages: +- stage: 'Build' + displayName: 'Build the web application' + jobs: + - job: 'Build' + displayName: 'Build job' + pool: + vmImage: 'ubuntu-20.04' + demands: + - npm + + variables: + wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot' + dotnetSdkVersion: '6.x' + + steps: + - task: UseDotNet@2 + displayName: 'Use .NET SDK $(dotnetSdkVersion)' + inputs: + version: '$(dotnetSdkVersion)' + + - task: Npm@1 + displayName: 'Run npm install' + inputs: + verbose: false + + - script: './node_modules/.bin/node-sass $(wwwrootDir) --output $(wwwrootDir)' + displayName: 'Compile Sass assets' + + - task: gulp@1 + displayName: 'Run gulp tasks' + + - script: 'echo "$(Build.DefinitionName), $(Build.BuildId), $(Build.BuildNumber)" > buildinfo.txt' + displayName: 'Write build info' + workingDirectory: $(wwwrootDir) + + - task: DotNetCoreCLI@2 + displayName: 'Restore project dependencies' + inputs: + command: 'restore' + projects: '**/*.csproj' + + - task: DotNetCoreCLI@2 + displayName: 'Build the project - $(buildConfiguration)' + inputs: + command: 'build' + arguments: '--no-restore --configuration $(buildConfiguration)' + projects: '**/*.csproj' + + - task: DotNetCoreCLI@2 + displayName: 'Publish the project - $(buildConfiguration)' + inputs: + command: 'publish' + projects: '**/*.csproj' + publishWebProjects: false + arguments: '--no-build --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/$(buildConfiguration)' + zipAfterPublish: true + + - publish: '$(Build.ArtifactStagingDirectory)' + artifact: drop + +- stage: 'Dev' + displayName: 'Deploy to the dev environment' + dependsOn: Build + jobs: + - deployment: Deploy + pool: + vmImage: 'ubuntu-20.04' + environment: dev + variables: + - group: Release + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: drop + - task: AzureWebApp@1 + displayName: 'Azure App Service Deploy: website' + inputs: + azureSubscription: 'Resource Manager - Tailspin - Space Game' + appType: 'webApp' + appName: '$(WebAppNameDev)' + package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip' + deploymentMethod: 'auto' + +- stage: 'Test' + displayName: 'Deploy to the test environment' + dependsOn: Dev + jobs: + - deployment: Deploy + pool: + vmImage: 'ubuntu-20.04' + environment: test + variables: + - group: 'Release' + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: drop + - task: AzureWebApp@1 + displayName: 'Azure App Service Deploy: website' + inputs: + azureSubscription: 'Visual Studio Enterprise Subscription(b339a5d1-6a50-4675-b00d-7b4af859bdd9)' + appType: 'webApp' + appName: '$(WebAppNameTest)' + package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip' + deploymentMethod: 'auto' + +#- stage: 'TestSlot' +# displayName: 'Deploy to the test slot' +# dependsOn: Test +# jobs: +# - deployment: Deploy +# pool: +# vmImage: 'ubuntu-20.04' +# environment: testslot +# variables: +# - group: 'Release' +# strategy: +# runOnce: +# deploy: +# steps: +# - download: current +# artifact: drop + + + +- stage: 'Staging' + displayName: 'Deploy to the staging environment' + dependsOn: Test + jobs: + - deployment: Deploy + pool: + vmImage: 'ubuntu-20.04' + environment: staging + variables: + - group: 'Release' + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: drop + - task: AzureWebApp@1 + displayName: 'Azure App Service Deploy: Swap Slot' + inputs: + azureSubscription: 'Visual Studio Enterprise Subscription(1)(b339a5d1-6a50-4675-b00d-7b4af859bdd9)' + appType: 'webApp' + appName: '$(WebAppNameStaging)' + deployToSlotOrASE: true + resourceGroupName: 'SpaceGame2-rg' + slotName: 'swap' + package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip' + deploymentMethod: 'auto' +# - task: AzureWebApp@1 +# displayName: 'Azure App Service Deploy: Test Slot' +# inputs: +# azureSubscription: 'Visual Studio Enterprise Subscription(1)(b339a5d1-6a50-4675-b00d-7b4af859bdd9)' +# appType: 'webApp' +# appName: '$(WebAppNameStaging)' +# deployToSlotOrASE: true +# resourceGroupName: 'SpaceGame2-rg' +# slotName: 'test-slot' +# package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip' +# deploymentMethod: 'auto' + + +# - task: AzureAppServiceManage@0 +# displayName: Swap Deployment Slots +# inputs: +# azureSubscription: 'Visual Studio Enterprise Subscription(b339a5d1-6a50-4675-b00d-7b4af859bdd9)' +# Action: 'Swap Slots' +# WebAppName: '$(WebAppNameStaging)' +# ResourceGroupName: 'SpaceGame2-rg' +# SourceSlot: 'swap' +
An example site for learning
Where does this show up? Hopefully Test Slot only!