Skip to content

Commit 936c71b

Browse files
committed
Added release branch arg in ensure-release-branch
1 parent 42b00b2 commit 936c71b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/actions/ensure-release-branch/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ inputs:
22
release_tag:
33
description: 'Release tag to build'
44
required: true
5+
release_branch:
6+
description: 'Existing release branch'
7+
required: false
58
allow_modify:
69
description: 'Allow modifying the repository'
710
default: false
@@ -26,4 +29,4 @@ runs:
2629
GITHUB_TOKEN: ${{ inputs.gh_token }}
2730
shell: bash
2831
run: |
29-
${{ github.action_path }}/ensure-release-branch.sh ${{ inputs.allow_modify == 'true' && '--allow-modify' || '' }} ${{ inputs.release_tag }}
32+
${{ github.action_path }}/ensure-release-branch.sh ${{ inputs.allow_modify == 'true' && '--allow-modify' || '' }} ${{ inputs.release_branch != "" && format('--release-branch {0}', inputs.release_branch) || '' }} ${{ inputs.release_tag }}

.github/actions/ensure-release-branch/ensure-release-branch.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@ SCRIPT_DIR="$(dirname -- "$( readlink -f -- "$0"; )")"
2222
# Parse arguments
2323
ALLOW_MODIFY=""
2424
TAG=""
25+
RELEASE_BRANCH=""
2526

2627
while [[ $# -gt 0 ]]; do
2728
case $1 in
2829
--allow-modify)
2930
ALLOW_MODIFY=1
3031
shift
3132
;;
33+
--release-branch)
34+
RELEASE_BRANCH="$2"
35+
shift
36+
shift
37+
;;
3238
-*)
3339
echo "Error: Unknown option $1"
3440
exit 1
@@ -47,7 +53,7 @@ done
4753

4854
if [ -z "$TAG" ]; then
4955
echo "Error: TAG is required as argument"
50-
echo "Usage: $0 [--allow-modify] <TAG>"
56+
echo "Usage: $0 [--allow-modify] [--release-branch BRANCH] <TAG>"
5157
exit 1
5258
fi
5359

@@ -59,8 +65,11 @@ echo "release_version_branch=$RELEASE_VERSION_BRANCH" >> "$GITHUB_OUTPUT"
5965
echo "TAG: $TAG"
6066
echo "RELEASE_VERSION_BRANCH: $RELEASE_VERSION_BRANCH"
6167

62-
# Detect RELEASE_BRANCH name (release/X.Y format)
63-
RELEASE_BRANCH="release/$(echo "$TAG" | grep -Po '^\d+\.\d+')"
68+
if [ -z "$RELEASE_BRANCH" ]; then
69+
# Detect RELEASE_BRANCH name (release/X.Y format)
70+
RELEASE_BRANCH="release/$(echo "$TAG" | grep -Po '^\d+\.\d+')"
71+
fi
72+
6473
echo "RELEASE_BRANCH: $RELEASE_BRANCH"
6574
echo "release_branch=$RELEASE_BRANCH" >> "$GITHUB_OUTPUT"
6675

0 commit comments

Comments
 (0)