Skip to content

Commit

Permalink
manual input for branch
Browse files Browse the repository at this point in the history
  • Loading branch information
XinRanZhAWS committed Apr 9, 2024
1 parent 98a5c22 commit a7c3dba
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/pre_release_prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
version:
description: 'Version number (e.g., 1.0.1)'
required: true
is_patch:
description: 'Is this a patch? (true or false)'
required: true
default: 'false'

permissions:
contents: write
Expand Down Expand Up @@ -33,14 +37,33 @@ jobs:
- name: Create branches
run: |
IS_PATCH=${{ github.event.inputs.is_patch }}
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
exit 1
fi
if git ls-remote --heads origin release/${MAJOR_MINOR}.x | grep -q "release/${MAJOR_MINOR}.x"; then
git fetch origin release/${MAJOR_MINOR}.x
echo "Branch release/${MAJOR_MINOR}.x already exists, checking out."
git checkout "release/${MAJOR_MINOR}.x"
if [ "$IS_PATCH" = "true" ]; then
git fetch origin release/${MAJOR_MINOR}.x
echo "Branch release/${MAJOR_MINOR}.x already exists, checking out."
git checkout "release/${MAJOR_MINOR}.x"
else
echo "Error, release series branch release/${MAJOR_MINOR}.x exist for non-patch release"
echo "Check your input or branch"
exit 1
fi
else
echo "Creating branch release/${MAJOR_MINOR}.x."
git checkout -b "release/${MAJOR_MINOR}.x"
git push origin "release/${MAJOR_MINOR}.x"
if [ "$IS_PATCH" = "true" ]; then
echo "Error, release series branch release/${MAJOR_MINOR}.x NOT exist for patch release"
echo "Check your input or branch"
exit 1
else
echo "Creating branch release/${MAJOR_MINOR}.x."
git checkout -b "release/${MAJOR_MINOR}.x"
git push origin "release/${MAJOR_MINOR}.x"
fi
fi
git checkout -b "${VERSION}_release"
Expand Down

0 comments on commit a7c3dba

Please sign in to comment.