Release / Prerelease action triggers #26281
-
I’m having some trouble writing triggers for when I make a new release of my project. I have two workflows that are triggered on different releases (Releases vs. Pre-Releases). I only want the Pre-Release Workflow to run on Releases that are marked as a pre-release and only run the Release Workflow on releases not marked as a pre-release. I’ve read the documentation and saw that Actions supports this functionality but I’ve set it up and the Release workflow runs on both Pre-Release and actual releases. I’ve linked both below for reference, any ideas? Release: https://github.com/wstyres/Zebra/blob/master/.github/workflows/release.yml#L5 Pre-Release: https://github.com/wstyres/Zebra/blob/master/.github/workflows/beta-release.yml#L5 |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
There is not a released type for release event, if use published instead, when create a pre-released version, we also need to publish it. So published type workflow will be trigged both Pre-Release and actual releases. As a work around, in published type workflow, you could add if condition to filter pre-release attribute. If it equals false , then run the job. If is true, then skip the job.
For example: I need to mention that this work around could not stop workflow to be triggered, just stop the job to run. When a pre-release published, both two workflows are triggered, but the job in Upload Release will be skipped and the whole workflow run shows failed. |
Beta Was this translation helpful? Give feedback.
-
Or is there a way to have one workflow run and use that if tag to run one or the other? The only real change between the two workflows is where I’m CDing into a directory (beta vs. repo) So if there were a simplier way to combine both that would work as well |
Beta Was this translation helpful? Give feedback.
-
Is not a really good solution but thank you! I hope github will allow us to have a prereleased and released types in the near future :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
@ckgrafico Good news! GitHub engineering team is working on adding released type to Release event. I would be on production in the near future. Although I don’t have a timeline for it , you could keep an eye on https://github.blog/changelog/ for new released features. |
Beta Was this translation helpful? Give feedback.
-
Thanks, this will do for us. For the “pre-release” -> “release” (by unchecking the box and releasing after a pre-release) we had to listen to |
Beta Was this translation helpful? Give feedback.
-
Follow up on this: If I have a workflow (c.f. Add pre-release support to publish workflow · Issue #1907 · scikit-hep/pyhf · GitHub) that I want to run on
this will run on normal GitHub releases, but does not run on GitHub pre-releases. Does this mean that as there is the |
Beta Was this translation helpful? Give feedback.
-
5 years later, there are now References: |
Beta Was this translation helpful? Give feedback.
There is not a released type for release event, if use published instead, when create a pre-released version, we also need to publish it. So published type workflow will be trigged both Pre-Release and actual releases.
As a work around, in published type workflow, you could add if condition to filter pre-release attribute. If it equals false , then run the job. If is true, then skip the job.
For example:
I need to mention that this work around could not stop workflow to be triggered, just stop the job to run. When a pre-release published, both two workflows are triggered, but the job in Upload Release will be skip…