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?
-
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).Johannes Riecken– Johannes Riecken2022年11月01日 07:32:49 +00:00Commented Nov 1, 2022 at 7:32
1 Answer 1
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