Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tailspin.SpaceGame.Web/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ public IActionResult Error()
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
}
2 changes: 1 addition & 1 deletion Tailspin.SpaceGame.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
});
}
}
}
}
147 changes: 147 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
trigger:
- '*'

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'
appName: '$(WebAppNameDev)'
package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip'

- 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: 'Resource Manager - Tailspin - Space Game'
appName: '$(WebAppNameTest)'
package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip'

- 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: website'
inputs:
azureSubscription: 'Resource Manager - Tailspin - Space Game'
deployToSlotOrASE: 'true'
resourceGroupName: 'tailspin-space-game-rg'
slotName: 'swap'
appName: '$(WebAppNameStaging)'
package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip'
- task: AzureAppServiceManage@0
displayName: 'Swap deployment slots'
inputs:
azureSubscription: 'Resource Manager - Tailspin - Space Game'
resourceGroupName: 'tailspin-space-game-rg'
webAppName: '$(WebAppNameStaging)'
sourceSlot: 'swap'
targetSlot: 'production'
action: 'Swap Slots'