Create bump commit on release branch #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create bump commit on release branch | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseBranchVersion: | |
description: > | |
"This workflow will create a PR to add a bump version commit on the release branch. | |
Enter the release branch version release/X.XXX.0:" | |
required: true | |
type: string | |
default: "X.XXX.0" | |
bumpCommitType: | |
description: "Choose the type of bump commit:" | |
required: true | |
type: choice | |
default: "minor" | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
create_bump_commit: | |
runs-on: ubuntu-latest | |
name: create bump commit PR | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: release/${{ github.event.inputs.releaseBranchVersion}} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install bump2version | |
- name: Set git identity | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Create PR with the bump commit | |
run: | | |
git fetch --quiet | |
curl https://raw.githubusercontent.com/kili-technology/kili-python-sdk/main/.github/scripts/utils.sh --output utils.sh | |
source ./utils.sh # to get the bump_version function | |
# create PR branch | |
git checkout -b workflow/create-bump-commit-release-branch-${{ inputs.releaseBranchVersion }}-${{ github.run_id }} | |
# create bump commit | |
new_version=$(bump_version commit ${{ inputs.bumpCommitType }}) | |
echo "New version (bump_version): $new_version" | |
# create PR | |
git push --quiet --set-upstream origin workflow/create-bump-commit-release-branch-${{ inputs.releaseBranchVersion }}-${{ github.run_id }} | |
gh pr create --base release/${{ inputs.releaseBranchVersion }} --title "chore: bump version to $new_version" --body "Bump version to $new_version on branch release/${{ inputs.releaseBranchVersion }}" | |
env: | |
GH_TOKEN: ${{ github.token }} # needed for gh cli |