Example Azure DevOps Pipeline for Angular
This example Azure pipeline for Angular performs the following steps:
- It triggers the pipeline when changes are pushed to the main branch, specifically within the 'src' directory.
- It specifies the agent pool to use, in this case, an Ubuntu-based agent.
- It installs Node.js using the NodeTool task.
- It installs the npm dependencies required for the Angular project.
- It builds the Angular app in production mode using the
npm run buildcommand.
- It copies the build output files from the
distdirectory to a staging directory.
- It publishes the build artifacts, creating a drop containing the build output.
- main # Build when changes are pushed to the main branch
- 'src/**' # Only trigger the build if changes are made within the 'src' directory
vmImage: 'ubuntu-latest' # Choose the appropriate agent image for your project
- task: NodeTool@0
versionSpec: '14.x' # Use the appropriate Node.js version
displayName: 'Install Node.js'
- script: npm install
displayName: 'Install npm dependencies'
- script: npm run build -- --prod
displayName: 'Build Angular app'
- task: CopyFiles@2
SourceFolder: '$(Build.SourcesDirectory)/dist' # Specify the build output directory
Contents: '**' # Copy all files
displayName: 'Copy build output'
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts'
About Sean Nelson
I like codes and stuff.