Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Action different between release created and published

since Github Releases are actually a Git Tags, I want to auto-upgrade my package.json version when there is a new Release (and tag), with Github Action.

I know I need to trigger a job on: release, but according to Github Actions docs I don't know if I need to trigger when created, published, both or all?

Github says:

Note: The release event is not triggered for draft releases.

And I created two pipelines: one on: release, type: created and one on: release, type: published.

Then I created a draft release, and then I published it.

Only the published pipeline triggered, and it was when I published the release.

like image 732
baruchiro Avatar asked Dec 13 '19 09:12

baruchiro


People also ask

What are the two types of GitHub Actions?

Types of actions. You can build Docker container and JavaScript actions.

What does publish release do in GitHub?

From Official GitHub: Releases are GitHub's way of packaging and providing software to your users. You can think of it as a replacement to using downloads to provide software. With Releases, you can provide links to binary files, as well as release notes describing your changes.

What is release in GitHub Actions?

This is a GitHub Actions that automates the release of GitHub Actions . If there is release which has same tag name and has been published, re-publish it (Because if the tag is changed, the release will be in a draft state).

What is Workflow_dispatch GitHub Actions?

This action triggers another GitHub Actions workflow, using the workflow_dispatch event. The workflow must be configured for this event type e.g. on: [workflow_dispatch] This allows you to chain workflows, the classic use case is have a CI build workflow, trigger a CD release/deploy workflow when it completes.


Video Answer


1 Answers

My experience has been the opposite of what was described here on the forum. When tested:

  • If the release is created from "Draft a new release" button on the /releases page, both events will trigger, as the release goes from state "draft" to "published".
  • If the release is created by scripts like release-it, bypassing "draft" stage and becoming "published" directly, only release:published will trigger

So apparently a release can be published without being created. Weird indeed. I'd go with published.

like image 161
Lucia Avatar answered Sep 18 '22 15:09

Lucia