1

I have a project in which I have two yml files under .github/workflows/ as below:

build.yml
release.yml

I use annotated tags to do releases and here is how the trigger looks like in build.yml:

on:
 push:
 paths-ignore:
 - 'images/**'
 - README.md
 branches:
 - master
 tags:
 - 'v*.*.*'
 pull_request:
 branches:
 - master

And here is how it looks like in release.yml:

on:
 push:
 # Sequence of patterns matched against refs/tags
 tags:
 - '[0-9]+.[0-9]+.[0-9]+'

I did the following to push a new annotated tag:

git tag -a v0.0.3-SNAPSHOT -m "My very third tag with release" 
git push origin --tags

I was actually expecting my release.yml to get triggered, but it does not. Is there anything that I'm missing?

torek
500k71 gold badges765 silver badges892 bronze badges
asked Nov 1, 2022 at 7:01
1
  • Where in the reference do you see that patterns are allowed for tags? Check what they say about the pattern syntax, for example your build.yml uses glob syntax and the release.yml uses regex syntax (where the regex doesn't match the entire string of your tag). Commented Nov 1, 2022 at 7:32

1 Answer 1

2

The regex will not match your tag 'v0.0.3-SNAPSHOT'. Missing the 'v' and the trailing text section. You could match it with the following:

 - 'v[0-9]+.[0-9]+.[0-9]+-[a-zA-Z]*'

Example can be found here. Not sure why you cant use the '.*' as any character any number of times.

See working example here -> https://github.com/jnus/trigger-semver-tags/blob/main/.github/workflows/workflow.yml

answered Nov 1, 2022 at 8:14
Sign up to request clarification or add additional context in comments.

4 Comments

No, even that seems not to work. I just pushed a tag and not even the build.yml is getting fired.
Just tried it out - works perfectly. E.g. git tag -a v0.0.6-SNAPSHOT -m "0.0.6 release" && git push --tags
Have you got a project to share?
Sure - just updated my answer

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.