'Github Action trigger on release not working on tag
I've created a "publish" workflow in new repository that publish my project on new release with this trigger
on:
release:
types:
- created
In my local machine I created a tag and pushed it:
git tag v0.0.1 main
git push origin v0.0.1
Now I see that my repo contains 1 tag and 1 release, but the workflow did not run.
Why the release trigger did not fire when new release created with the tag?
Solution 1:[1]
This is confusing in the GitHub Actions documentation on the "Events that Trigger Workflows." https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
It states that Activity Types are "published," "unpublished," and "prerelease" but it doesn't tell you how to invoke these activities. You need to create a GitHub "Release" Event by either using the web portal or the gh CLI. Follow this documentation: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
If that link changes look for the Release button in the GitHub web portal. Just creating a git tag is not enough.
From the gh CLI the command is like: gh release create v1.3.2 --title "v1.3.2 (beta)" --notes "this is a beta release" --prerelease
In short git tag is not the event that triggers a GitHub Release event.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user361446 |