带有分支过滤器的GitHub Actions标签过滤器

编程入门 行业动态 更新时间:2024-10-25 22:27:07
本文介绍了带有分支过滤器的GitHub Actions标签过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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标签过滤器

本文发布于:2023-10-13 20:34:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1489004.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:过滤器   分支   标签   GitHub   Actions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!