diff --git a/README.md b/README.md index ece99adf323..7a2662c0903 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - +[![Build Status](https://dev.azure.com/appdev-upskilling-fy26/daryl.b.sardon/_apis/build/status%2FdarsAcn.mslearn-tailspin-spacegame-web?branchName=main)](https://dev.azure.com/appdev-upskilling-fy26/daryl.b.sardon/_build/latest?definitionId=84&branchName=main) # Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a @@ -63,3 +63,4 @@ Privacy information can be found at https://privacy.microsoft.com/en-us/ Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise. + diff --git a/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml b/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml index f7c4c886074..79b4cb2750c 100644 --- a/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml +++ b/Tailspin.SpaceGame.Web/Views/Home/Index.cshtml @@ -5,7 +5,7 @@
Space Game -

An example site for learning

+

Welcome to the official Space Game site!

diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 23402e427df..0e334e5a2b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,82 @@ -pool: MyAgentPool +trigger: +- '*' + +pool: + vmImage: ubuntu-latest + +variables: + buildConfiguration: 'Release' + wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot' + dotnetSdkVersion: '8.x' + steps: -- bash: echo hello world \ No newline at end of file +# ✅ Use Node 18 LTS +- task: UseNode@1 + displayName: 'Use Node.js 18 LTS' + inputs: + version: '18.x' + +# ✅ Install dependencies safely +- script: | + npm cache clean --force + npm install --legacy-peer-deps + displayName: 'Install npm dependencies' + +# ✅ Compile Sass assets +- script: | + ./node_modules/.bin/node-sass $(wwwrootDir) --output $(wwwrootDir) + displayName: 'Compile Sass assets' + +# ✅ Run Gulp tasks +- task: Gulp@1 + displayName: 'Run Gulp tasks' + +# ✅ Record build info +- script: 'echo "$(Build.DefinitionName), $(Build.BuildId), $(Build.BuildNumber)" > buildinfo.txt' + displayName: 'Write build info' + workingDirectory: $(wwwrootDir) + +# ✅ .NET SDK setup +- task: UseDotNet@2 + displayName: 'Use .NET SDK $(dotnetSdkVersion)' + inputs: + packageType: sdk + version: '$(dotnetSdkVersion)' + +# ✅ Restore .NET project dependencies +- task: DotNetCoreCLI@2 + displayName: 'Restore project dependencies' + inputs: + command: 'restore' + projects: '**/*.csproj' + +# ✅ Build the .NET project +- task: DotNetCoreCLI@2 + displayName: 'Build the project - $(buildConfiguration)' + inputs: + command: 'build' + arguments: '--no-restore --configuration $(buildConfiguration)' + projects: '**/*.csproj' + +- template: templates/build.yml + parameters: + buildConfiguration: 'Debug' + +- template: templates/build.yml + parameters: + buildConfiguration: 'Release' + +# ✅ Publish the .NET project +- 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 artifacts +- task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' + condition: succeeded() diff --git a/templates/build.yml b/templates/build.yml new file mode 100644 index 00000000000..15ca39ca575 --- /dev/null +++ b/templates/build.yml @@ -0,0 +1,19 @@ +parameters: + buildConfiguration: 'Release' + +steps: +- task: DotNetCoreCLI@2 + displayName: 'Build the project - ${{ parameters.buildConfiguration }}' + inputs: + command: 'build' + arguments: '--no-restore --configuration ${{ parameters.buildConfiguration }}' + projects: '**/*.csproj' + +- task: DotNetCoreCLI@2 + displayName: 'Publish the project - ${{ parameters.buildConfiguration }}' + inputs: + command: 'publish' + projects: '**/*.csproj' + publishWebProjects: false + arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --output $(Build.ArtifactStagingDirectory)/${{ parameters.buildConfiguration }}' + zipAfterPublish: true \ No newline at end of file