unsafe_where_true
unsafe_where_true

Reputation: 6300

Run a github action after new tag creation

 on:
     push:
       tags:
        - '*' # Push events to every tag

which I got from Trigger Github Action only on new tags?

I created this github action, thinking that it would run after a newly created tag.

So I pushed this on a branch, as .github/workflows/onnewtag.yml file.

Then, staying on this same branch, I created a new tag: git tag -a 0.0.1 -m "first attempt".

Then I pushed this new tag: git push <remote> <branch> --tags

But nothing happens. Obviously there must be some thinking mistake on my side?

I have also tried pushing to the tag itself:

git checkout tags/0.0.1 -b tags-test then edit something, git add and git commit, then git push <remote> <tag> For this I even get "Everything up-to-date"

What we really want is an action which will run every time we create a new release. We were thinking that creating a tag would signal a new release. Maybe tags is the wrong way to do this?

Upvotes: 2

Views: 8333

Answers (1)

The Otterlord
The Otterlord

Reputation: 2185

The release event is useful here.

Since you want the event to run each time a new release is published, you can use the published activity type to filter out editing/deleting/etc...

on:
  release:
    types: [published]

You may also wish to consider adding the prereleased tag depending on your specific use case.

Upvotes: 5

Related Questions