Azure Pipelines is a cloud service that you can use to automatically build and test your code projects and make them available to other users. It works in almost any language or project type.
Azure Pipelines combines continuous integration (CI) and continuous delivery (CD) to continuously test and build your code and deliver it to any target.
You can use multiple languages in Azure Pipelines, such as Python, Java, JavaScript, PHP, Ruby, C#, C++, and Go.
This article explains howUse Azure DevOps Pipelines to automate the release of nuget packages to private repositories。
Create a new project in Azure DevOps with the name: dotnet-pull-nuget (the name is wrong, it doesn't matter)
Use VS 2019 to create a new .NET Core 3.1 library project named dotnet-pull-nuget
Add the project to the source manager, that is, check in to the Azure DevOps repository, click on Team Explorer, select "Manage Connection" at the top, enter our private Azure DevOps address, and enter the account and password.
Create a new pipeline project with YAML syntax, select "Azure Repos Git" in the code, and the yml configuration file is as follows:
The function of this build pipeline is that whenever we have a code update (Push) to the remote master branch, it will automatically be used to automatically build, (automatic testing, skipped here), and automatically package and generate Artifacts for later automatic deployment pipelines.
You can manually trigger the execution of the pipeline by clicking "Run Pipeline" in the upper right corner, the following is the execution history of my execution, as shown in the figure below:
You can click on a certain item and then click on the job to view the execution, as shown in the figure below:
Click Pipelines -> Publish -> to create a new release pipeline, stage 1, and select an empty job.
Click View Stage Tasks to go to the Tasks tab page, as shown below:
Add a nuget task as shown below:
Select push, the path to the nuget package to be published, and fill in the following information:
Click the New button to the right of NuGet Server to add our private NuGet repository address, as shown below:
Enter the source URL and ApiKey, as shown in the following image:
For variables, see:The hyperlink login is visible.
For information on how to set up a private NuGet repository, see:https://www.itsvse.com/thread-9380-1-1.html
The complete configuration is shown below:
The YAML format is configured as follows:
The source alias is set according to the release name information of the new pipeline at the beginning, and the project configuration is as follows:
You can set a continuous deployment trigger, that is, after we submit the code to check in, the pipeline will be executed, and then the release task will be triggered, as shown in the figure below:
Click Save in the upper right corner to create a post.
You can see that our nuget package was successfully pushed to the private repository.
The release history and execution status are shown in the following figure:
After the release is successful, open the private Nuget repository address and you can see the latest package we pushed, as shown in the figure below:
We can add our private NuGet repository address through the NuGet package manager, package source, as shown in the figure below:
Nuget updates can also be viewed through the VS tool, as shown below:
(End)
|