I prefer to organize my artifacts in Artifactory in a hierarchy of Repo[dev|test|prod] -> Artifact Name -> Releases Artifacts go here -> Pre-Releases go into a sub-folder.
Why? So when I am navigating the Artifactory Repository Browser I don't have an exceedingly long tree. I can expand a repository and see the first level by artifact name and still not see any artifacts, then expand the artifact name leaf and then see my released artifacts. But, the top item underneath will be a sub-directory folder called "prerelease". This is done so I can easily manually delete all my pre-releases if I wish to do so in one action, or schedule to clean them up.
[My Repo]
|
+-\prerelease\
| |--artifact-1.2.3-ci0004.nupkg
| |--artifact-1.0.1-ci0002.nupkg
|--artifact-1.0.0.nupkg
|--artifact-1.0.1.nupkg
I know how to use the Artifactory filespec to upload the package to my repository:
** For Pre-Release
{
"files": [
{
"pattern": "$(build.artifactstagingdirectory)\*.nupkg",
"target": "myrepo-nuget-dev-local/$(PackageName)/prerelease/"
}
]
}
** For Release
{
"files": [
{
"pattern": "$(build.artifactstagingdirectory)\*.nupkg",
"target": "myrepo-nuget-dev-local/$(PackageName)/"
}
]
}
What I need to do is put each file spec into its own build step and then add conditions that will execute EITHER one build step OR the other, but never both. Why? Because the build artifact will ever be a pre-release or a release artifact but never both. I am using GitVersion and Git Tags along with Azure DevOps.
So the question: What does the Custom Condition need to be to get this working?