GitHub动作允许使用分支过滤器和标签过滤器,但它们似乎无法协同工作.
GitHub actions allow the use of branch and tag filters, but they don't seem to work together.
例如,此工作流运行在具有标签的 或 推送上.
For example, this workflow runs on pushes to master or pushes with a tag.
name: npm Publish on: push: branches: - master tags: - v*我想设置一个发布工作流,该工作流在标记的主控推送上运行,而不仅仅是一个或另一个.该怎么办?
I want to setup a publishing workflow that runs on tagged pushes to master, not just one or the other. How can this be done?
推荐答案一种解决方案是使用on: release代替on: push.当通过GitHub UI发布发布时,这将触发工作流程执行.当您在GitHub上发布发行版时,它会使用您指定的发行版版本标记master分支.因此,保证工作流的每次执行都是master分支上的带标记的提交.
One solution is to use on: release instead of on: push. This will trigger the workflow to execute when a release is published via the GitHub UI. When you publish a release on GitHub it tags the master branch with the version of the release that you specify. Each execution of the workflow is therefore guaranteed to be a tagged commit on the master branch.
name: npm Publish on: release更多推荐
带有分支过滤器的GitHub Actions标签过滤器
发布评论