Tags
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 build
command. - It copies the build output files from the
dist
directory to a staging directory. - It publishes the build artifacts, creating a drop containing the build output.
trigger:
branches:
include:
- main # Build when changes are pushed to the main branch
paths:
include:
- 'src/**' # Only trigger the build if changes are made within the 'src' directory
pool:
vmImage: 'ubuntu-latest' # Choose the appropriate agent image for your project
steps:
- task: NodeTool@0
inputs:
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
inputs:
SourceFolder: '$(Build.SourcesDirectory)/dist' # Specify the build output directory
Contents: '**' # Copy all files
TargetFolder: '$(Build.ArtifactStagingDirectory)/dist'
displayName: 'Copy build output'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/dist'
artifactName: 'drop'
displayName: 'Publish build artifacts'
About Sean Nelson
I like codes and stuff.
|
1 comments