小编Ant*_*ros的帖子

如何在发布时在 github 操作中获取目标分支

我有一个 github 操作,应该使用 github UI 提供的发行版本更新当前分支tag_name

除了目标分支的未知变量名称之外,一切似乎都有效。

on:
  release:
    types: [created]

jobs:
  update-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2 # <-- I want the branch to match github release selected branch
      - name: Update version
        run: |
          tag_name=$(echo "${github.event.release.tag_name}" | sed -e 's/[]$.*[\^]/\\&/g' )
          sed -i "s/\"version\": \".*\",/\"version\": \"${tag_name}\",/" ./src/components/package.json
      - name: Commit Updated version.
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add . && git commit -m "Bump version" -a …
Run Code Online (Sandbox Code Playgroud)

github-actions

8
推荐指数
1
解决办法
2305
查看次数

标签 统计

github-actions ×1