Release / Prerelease action triggers

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?



1 Like

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.

if: "!github.event.release.prerelease"

For example:

work around.png

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.


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

1 Like

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:

@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 for new released features. 

1 Like

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 edited event too. The problem there is that edited doesn’t take into consideration the checkbox. If we edit the text, uncheck and save, then it will trigger edited, but if only the checkbox is unchecked then not