Distinguish stable vs. unstable builds

Hi, I try to distinguish stable & unstable builds by tag on the same branch.

name: stable
on: 
  push:
    tags: 
      - '[0-9]+.[0-9]+.[0-9]+'
...

name: unstable
on: 
  push:
    tags: 
      - '*'
      - '![0-9]+.[0-9]+.[0-9]+'

but as soon as I push my annotated tag both builds are triggered (on on latest commit ref and one on the tag ref). How can I suppress the non taged build ?

Hi, could you double check that your tag filters are correct? https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

If they are, could you provide an example of an unstable build vs a stable build so we can see how you are trying to filter it?

you can find an example here: https://github.com/DomainDrivenArchitecture/dda-devops-build/blob/89f54fb8ebd80856a2395c3e8de61e8ee84de85b/.github/workflows

Hi, I think because

on: 
  push:
    tags: 
      - '*'

Matches zero or more characters, but does not match the / character. For example, Octo* matches Octocat .

So I think that is why it is being triggered. Could you try to remove it?

Otherwise, we see: 0.8.11 as a release, and we assume you’d like this to trigger the stable build. Could you show us an example where stable ran but it shouldn’t have?

Adjusted the tags according to your hint & tried a release. But unfortunately there start still two builds:

For creating a new release I use the following procedure:

adjust version no in build.py to release version no.
git commit -am "release"
git tag -am "release" [release version no]
git push --follow-tags
increase version no in build.py
git commit -am "version bump"
git push

Hi @jerger
I found that you set the master branch trigger in the unstable yaml.

name: unstable
on: 
  push:
    branches:
      - master

So one of the two builds is triggered by the branch, and the other is triggered by the tag. This should be the reason why you can see that both builds are triggered.

1 Like

Thanks for finding the issue.

branches & tags is handled as ‘or’, I expected ‘and’ …

Is there a way to add a branch constraint in addition ?

Hi @jerger
As far as I know, there is no way to achieve it. Workflows can use more than one webhook event to trigger a workflow run. Push tag and push branch are two independent events, and each event will trigger a workflow run.

Okay, now I can distinguish release from non release tags.

  • I can have stable builds giving tags like ‘0.1.0’ and
  • I can have unstable builds … but I’ve to tag them with sth. like ‘0.1.0-unstable’.

Can I have unstable builds for all my pushes but stable builds for pushes containing a stable tag?

Hi @jerger

Do you mean that you want to trigger one workflow by the branch and use git commands to create tag in current Workflows (such as: ’0.1.0-unstable’), also another workflow is still triggered by the tag(such as ‘0.1.0’)? If I misunderstood you, please correct me and describe it in more detail.

I want:

  1. trigger an unstable build on every push lets say on master branch if there is no tag like ‘0.1.0’ is contained,
  2. trigger an stable build if the push contains a tag like ‘0.1.0’

As i know, we cannot associate these two independent events. You could submit a feature requests for GitHub Actions. Thanks