Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/actions/ensure-release-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ inputs:
release_tag:
description: 'Release tag to build'
required: true
release_branch:
description: 'Existing release branch'
required: false
allow_modify:
description: 'Allow modifying the repository'
default: false
Expand All @@ -26,4 +29,4 @@ runs:
GITHUB_TOKEN: ${{ inputs.gh_token }}
shell: bash
run: |
${{ github.action_path }}/ensure-release-branch.sh ${{ inputs.allow_modify == 'true' && '--allow-modify' || '' }} ${{ inputs.release_tag }}
${{ 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 }}
15 changes: 12 additions & 3 deletions .github/actions/ensure-release-branch/ensure-release-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ SCRIPT_DIR="$(dirname -- "$( readlink -f -- "$0"; )")"
# Parse arguments
ALLOW_MODIFY=""
TAG=""
RELEASE_BRANCH=""

while [[ $# -gt 0 ]]; do
case $1 in
--allow-modify)
ALLOW_MODIFY=1
shift
;;
--release-branch)
RELEASE_BRANCH="$2"
shift
shift
;;
-*)
echo "Error: Unknown option $1"
exit 1
Expand All @@ -47,7 +53,7 @@ done

if [ -z "$TAG" ]; then
echo "Error: TAG is required as argument"
echo "Usage: $0 [--allow-modify] <TAG>"
echo "Usage: $0 [--allow-modify] [--release-branch BRANCH] <TAG>"
exit 1
fi

Expand All @@ -59,8 +65,11 @@ echo "release_version_branch=$RELEASE_VERSION_BRANCH" >> "$GITHUB_OUTPUT"
echo "TAG: $TAG"
echo "RELEASE_VERSION_BRANCH: $RELEASE_VERSION_BRANCH"

# Detect RELEASE_BRANCH name (release/X.Y format)
RELEASE_BRANCH="release/$(echo "$TAG" | grep -Po '^\d+\.\d+')"
if [ -z "$RELEASE_BRANCH" ]; then
# Detect RELEASE_BRANCH name (release/X.Y format)
RELEASE_BRANCH="release/$(echo "$TAG" | grep -Po '^\d+\.\d+')"
fi

echo "RELEASE_BRANCH: $RELEASE_BRANCH"
echo "release_branch=$RELEASE_BRANCH" >> "$GITHUB_OUTPUT"

Expand Down