How to run job if tag is v*

How to run job if tag is versioned, for example v1.2.3?

You can use an on.push.tags filter in the workflow, probably something similar to this:

      - 'v*'
1 Like

Thank you,

This solution is for whole workflow. The question is how to make condition by tag for specific job of workflow.

Oh, right! In that case you could try to build an if condition for the job that checks github.event.ref, maybe something like this:

if: startsWith(github.event.ref, 'refs/tags/v')

That’s assuming the job will only be called for push events, otherwise you’d have to check the event type first.

1 Like

It seems it is solution. Thank you!

I’ve tested with github.ref

There is missing documentation what the ref means

Yeah, that could use a link to something like the Git Internals - Git References chapter of the Git Book. Also if you want to know which refs are available in your local repository try git show-ref.

1 Like