I have a GitHub reposistory with a number of sub-modules/plugins which I would like to release individually. But there are some good reasons, why to maintain all in one repo.
Hence I have created different workflow-files supposed to create/publish a release for each module. My plan is to create that release directly from the GitHub-UI, giving a specific tag and publish it.
My goal was to restrict the workflows based on the given Release-Tag. E.g. tagname: module-abc-v1.0.0 - With that, only the according workflow should be fired, which I have configured like so:
name: Module-ABC Release on: release: types: - published tags: # If this tag is used, a release is created - '*module-abc*'
That's unfortunately not working and all existing Release-Workflows are fired everytime I publish a release. Of course I could manually check the release tag as part of the workflow and terminate it, but I would prefer not to start them at all.
Is this not supported at all or I'm doing something wrong? Any other ideas to support my use-case are very welcomed.
Filter patterns, such as tags, work only for push and pull_request events. That's why your release workflow isn't working as you expect. Here's the documentation section with more information.
Fortunately, you can use an `if` conditional at the job level to accomplish your goal.
Here's an example:
name: Module-ABC Release on: release: types: - published jobs: release-module-abc: if: contains(github.ref, 'refs/tags/module-abc') # definition of the release job for module-abc goes here release-module-def: if: contains(github.ref, 'refs/tags/module-def') # definition of the release job for module-def goes here
Many Thanks @jenschelkopf for the response.
I'll implement it the way you suggested.
Just thinking loud: Is there any technical reason, why these filters has been implemented for push and pull_requests only? I mean, it seems like the event contains the required information about the tags, so it would be consequent to provide that option for release events as well.
Hi @cwiechmann ,
Release is based on Git tags, it’s a specific tag in fact. No need to use ‘dup’ trigger in one workflow. According to the doc, currently filter ‘tags’ only apply for ‘push’ and ‘pull_request’ event. It’s recommended to raise a feedback ticket here if you would like more filters.