I get this warning when the pipeline runs:
Release will not be created as the tags for the target commit do not match with the given tag pattern.
Thing is, the Tag Pattern property of the GitHub release is blank; I'm not setting any particular tag pattern. How do I skip this warning so the release can be created every time the pipeline runs?
Click to get started building your first release pipeline! On the release pipelines page go to new, and select new release pipeline . There are many templates that Azure DevOps offers. This screen will appear and you’ll have the option to use a template or create an empty job.
Azure Pipelines releases can deploy artifacts that are produced by a wide range of artifact sources such as Azure Pipelines build, Jenkins, or Team City. You define the release pipeline using stages, and restrict deployments into or out of a stage using approvals.
When using GitHub with Azure DevOps $ (Build.SourceVersion) contains the commit id. See Microsoft docs, Predefined variables for a list of variables. Use $ (Build.BuildNumber) to use the version number used in the build. Define the release title, the title is shown in the header on GitHub releases page.
Azure Pipelines. Use this task in your pipeline to create, edit, or discard a GitHub release. This task requires a GitHub service connection with Write permission to the GitHub repository. You can create a GitHub service connection in your Azure Pipelines project. Once created, use the name of the service connection in this task's settings.
How do I make a release pipeline in Azure DevOps that creates a GitHub release every time?
I could reproduce this issue on my side, if I leave the Tag Pattern property of the GitHub release is blank.
That because this property is Required. Check the GitHub Release task:
Tag source (Required) Configure the tag to be used for release creation. The 'Git tag' option automatically takes the tag which is associated with this commit. Use the 'User specified tag' option in case you want to manually provide a tag.
As the description above, the 'Git tag' option automatically takes the tag which is
associated with this commit.
So, if we leave that property Tag Pattern is blank, the value is null, but the commit id is not null, then you will get this error. Check my detailed build log:
To resolve this issue, we could give the Tag Pattern with the commit ID. Or you could use the another option User specified tag, then you can manually provide a tag, like release-v1.0
.
As test, it works fine on my side.
Update:
but I want the pipeline to run every time someone pushes or merges code into the master branch; I don't want to have to specify a tag for each commit
If you do not want to have to specify a tag for each commit, you can use counter expressions in Variables, like:
variables:
MajorVersion: 1
MinorVersion: 0
InitialReleaseTagNumber: 1
IncrementReleaseTagNumber: $[counter(variables['InitialReleaseTagNumber'], 0)]
Then we set v$(MajorVersion).$(MinorVersion).$(IncrementReleaseTagNumber)
following in the tag option:
So, the value of the tag will increase by 1 once the build runs.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With