我创建了一个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发行版本号
发布评论