In our Jenkins pipeline, we are currently publishing build artifacts when commits are made to specific branches.
The Jenkinsfile
currently has something like this:
stage("Publish to Docker Registry") {
when { anyOf { branch "release"; branch "prerelease" } }
...
}
We would like to change this to executing on any tagged commit, but I cannot find anything about using tags as a trigger in the documentation:
https://jenkins.io/doc/book/pipeline/syntax/#when
Is this possible?
We are using git.