创建新标签后运行github操作

问题描述:

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

是我从触发Github上获得的

仅对新标签进行操作?

我创建了这个github动作,以为它会在新创建的标签之后运行.

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

所以我把它作为 .github/workflows/onnewtag.yml 文件推送到了分支上.

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

然后,在同一分支上,我创建了一个新标签: git标签-a 0.0.1 -m首次尝试" .

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

然后我推送了这个新标签: git push< remote><分支>--tags

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标签/0.0.1 -b标签测试然后编辑一些内容, git add git commit ,然后 git push< remote>< tag> 为此,我什至得到所有最新信息"

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?

发布事件在这里很有用.

由于您希望事件在每次发布新版本时都运行,因此可以使用 published 活动类型来过滤编辑/删除/等...

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]

您可能还希望根据您的特定用例考虑添加 prereleased 标记.

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