Member-only story
Using Azure Pipelines to publish the NuGet package from GitHub repo
I have got used to configure Azure DevOps Pipelines with the classic editor that allows us to configure lots of properties of the tasks with a friendly user interface. But the better way to configure the Pipelines is by using YAML
file. It is easy to fine-tune each option for your Pipeline, and easy to clone & share. That is why YAML
is the default Pipelines configuration template in Azure DevOps nowadays. I have developed a simple NuGet package that integrates Azure DevOps to build and publish (Implementing a simple messenger component for WPF, UWP and Xamarin). I will demonstrate how to create a new pipeline with YAML
file. Before we get started, let us spend several minutes to gain a basic understanding of YAML
.
What is YAML
?
YAML(YAML Ain’t Markup Language) is a human friendly data serialization standard for all programming languages.
— yaml.org
YAML
is designed to be human-friendly and work well with modern programming languages for common everyday tasks. It is similar to JSON
. Actually, you could treat YAML
as the superset of JSON
. Every JSON
file is also a valid YAML
file. But the difference is that they have different priorities. The foremost goal of JSON
is simplicity and universality so it is easy to generate and parse in every modern programming language. But for YAML
, the foremost design goal is to improve human readability. So YAML
is a little bit more complex to generate and parse.
Imagine how we can describe a basic data structure? There are three basic but important primitives: mappings (hashes/dictionaries), sequences (arrays/lists) and scalars (strings,/numbers). We could describe the structures of JSON
like this:
- A collection of name/value pairs. An object starts with
{
and ends with}
. Each name is followed by:
and the name/value pairs are separated by,
. - A list/array of values. An array begins with
[
and ends with]
. Values are separated by,
. - A value can be a string in double quotes, or a number, or
true
orfalse
ornull
, or an object or an array. These structures can be nested.
Let us see how it is in YAML
. There are similarities between YAML
and JSON
. We will not cover all the details of YAML
because Azure DevOps Pipelines does not support all features of YAML
.