如何在Github Action中使用Github发行版本号

编程入门 行业动态 更新时间:2024-10-28 08:23:22
本文介绍了如何在Github Action中使用Github发行版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个Github存储库,该存储库已采取行动来构建npm软件包并将其发布到npmjs.我行动的触发因素是在Github中创建了一个新版本.创建新版本时,Github要求我提供版本号.我很想在Action中使用此版本号,并将其提供给yarn publish命令.

I have created a Github repo that has got an action to build the npm package and publish it to npmjs. The trigger for my action is the creation of a new release in Github. When creating the new release, Github is asking me for a version number. I would love to use this version number in the Action and provide it to the yarn publish command.

我的ci文件看起来像这样(我剥去了一些不重要的部分):

My ci-file looks like this (i stripped some parts that are not important here):

name: Deploy npm package on: release: types: [created] jobs: publish-npm: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: 12 registry-url: registry.npmjs/ - run: yarn install - run: yarn build - run: yarn publish --new-version ${...} env:a NODE_AUTH_TOKEN: ${{secrets.npm_token}}

是否有一个环境变量包含该发行版的版本号?

Is there an environmental variable that contains the version number from the release?

推荐答案

您可以使用${{ github.event.release.tag_name }}获取标签版本.

You can get tag version using ${{ github.event.release.tag_name }}.

更多推荐

如何在Github Action中使用Github发行版本号

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

发布评论

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

>www.elefans.com

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