我有一个 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)