Step 1: Prerequisites
Make sure you have an Azure DevOps organization and project set up.
You should have access to the public repository on GitHub.
Step 2: Set up Azure Repos and Create a Repository
In your Azure DevOps organization, navigate to your project.
Click on "Repos" in the left menu.
Create a new repository or use an existing one to host your Node.js code.
Step 3: Create the Build Pipeline
Go to your Azure DevOps project and navigate to the "Pipelines" section.
Click on "Create Pipeline" to create a new pipeline.
Select your source repository (GitHub) and choose the repository that contains your Node.js code.
Azure DevOps will automatically detect the type of code repository and suggest a template. If it doesn't suggest one, select "Node.js" from the list of templates.\
Azure DevOps will generate a YAML file for the pipeline configuration. Review the YAML file and make sure it's correct for your Node.js project. You can customize it further as needed.
Step 4: Build your package and publish an artifact
Edit your azure-pipelines.yml file.
Update the Node.js Tool Installer task to use Node.js version 16 LTS.
# Node.js # Build a general Node.js project with npm. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript trigger: - main pool: vmImage: ubuntu-latest steps: - task: NodeTool@0 inputs: versionSpec: '16.x' displayName: 'Install Node.js' - script: | npm install npm run build displayName: 'npm install and build'
Click "Save & Run" to save your pipeline and trigger the build
.
Azure DevOps will execute the pipeline, and you'll see the build progress
.
If everything is set up correctly, the pipeline should successfully build your Node.js project.
Pipeline set up in Azure DevOps - Auto pulls & builds Node.js project on 'main' branch code changes. Happy coding! ๐