このアクションは現在の開発ブランチ(hotfix)をバージョンアップして、オープンしているプルリクエストのベースブランチを変更します。
既にバージョンアップ後の開発ブランチをリモートに作成していることが前提です。
Required リポジトリ名。
Required トークン。
Required 現在の開発ブランチバージョン
Required バージョンアップ後の開発ブランチバージョン
手動実行を前提としています。
secrets.GITHUB_TOKEN ではデフォルトブランチやプロテクトブランチの設定が出来ないので、個人アクセストークンを作成してください。
バージョンアップブランチの作成手順も合わせています。
on:
workflow_dispatch:
inputs:
current_version:
description: '現在のバージョン'
required: true
next_version:
description: 'バージョンアップ後のバージョン'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Before Branch
uses: actions/checkout@v2
- name: Create Release Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout -b release-${{ github.event.inputs.current_version }}
git push origin release-${{ github.event.inputs.current_version }}
- name: Checkout Before Branch
uses: actions/checkout@v2
with:
ref: hotfix-${{ github.event.inputs.current_version }}
- name: Create Hotfix Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout -b hotfix-${{ github.event.inputs.next_version }}
git push origin hotfix-${{ github.event.inputs.next_version }}
- name: version_up
id: bg_version_up
uses: hayashima/bg_version_up@v1
with:
repo: ${{ github.repository }}
token: ${{ secrets.PERSONAL_TOKEN }}
current_version: ${{ github.event.inputs.current_version }}
next_version: ${{ github.event.inputs.next_version }}