Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub-Actions: Trigger on creation of Draft of GitHub-Release

To simplify the release of a new version, I want to use GitHub-Actions to build my project. This should be triggered by creating a release-draft.

Basically, the workflow should be as follows:

When a new release should be created, a draft is created (manually), containing the proper tag, name and body. When the draft is saved, the action should take over and build the project in its current state, then add the built file to the release draft and finally publish it.

I don't want it to trigger when the draft is published, as it is already available then, even before the action has finished building the real file that should be released.

I tried using all triggers of release with

on: # When to trigger this action
  release: # trigger on all release-events
  workflow_dispatch: # allow manual triggering

However, that doesn't seem to trigger when the draft is saved, only when it's being published.

Is there any way to trigger this workflow without publishing the release, but only by creating a draft?

like image 815
MonsterDruide1 Avatar asked Mar 02 '26 03:03

MonsterDruide1


1 Answers

Since a release is normally associated to a tag, you could create the tag immediately (instead of a future tag the draft creates only on publish). If you do so, you may have an action on top of a tag creation.

on:
  push:
    # Pattern matched against refs/tags
    tags:        
      - '*'           # Push events to every tag not containing /

In your version tag action, you may create a draft release.

like image 112
Marcos Junior Avatar answered Mar 03 '26 21:03

Marcos Junior