Implementing a code workflow

C.J. Shields
3 min readJul 10, 2020

--

This project is a continuation of “Create a build pipeline with Azure Pipelines”

1) Sign into Azure DevOps Demo Generator

2) Create a new project called Space Game — web — Workflow Team (Note: This is a fork of the Space Game repository on GitHub)

3) Next, move which items you are working on, this gives others on your team visibility into what you are working on and how much is left. This process helps enforce work in progress, so the team does not take on too much work at a time

4) Next, create a branch and add starter code in Visual studio

5) Switch to the master branch Bash

6) Git checkout master

7) Ensure that you have the latest version of the code from GitHub Bash

8) Git pull origin master

9) Create a branch named code-workflow Bash

10) Git checkout -b code-workflow

11) From the file explorer you need to edit the azurepipelines.yml and replace with the following contents:

trigger:

- ‘*’

pool:

vmImage: ‘ubuntu-18.04’

demands:

- npm

variables:

buildConfiguration: ‘Release’

wwwrootDir: ‘Tailspin.SpaceGame.Web/wwwroot’

dotnetSdkVersion: ‘3.1.300’

steps:

- task: UseDotNet@2

displayName: ‘Use .NET Core 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

- task: PublishBuildArtifacts@1

displayName: ‘Publish Artifact: drop’

condition: succeeded()

12) I checked my status of git and noticed azure-piplines.yml has been modified. Ill commit that to my branch by I need to first make sure that Git is tracking this file.

13) Run these commands in Visual Studio to add azure-pipelines.yml to the staging area

Git add azure-pipelines.yml

Git commit -m “Add the build configuration”

Git push origin code-workflow

14)Next I selected my newly pushed codeworkflow from GitHub

--

--

C.J. Shields
C.J. Shields

Written by C.J. Shields

Systems/Network Administrator | DevOps Enthusiast

No responses yet