diff --git a/.github/actions/ensure-release-branch/action.yml b/.github/actions/ensure-release-branch/action.yml index d58b3d8..b18775f 100644 --- a/.github/actions/ensure-release-branch/action.yml +++ b/.github/actions/ensure-release-branch/action.yml @@ -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 @@ -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 }} diff --git a/.github/actions/ensure-release-branch/ensure-release-branch.sh b/.github/actions/ensure-release-branch/ensure-release-branch.sh index e5597f4..3c949d7 100755 --- a/.github/actions/ensure-release-branch/ensure-release-branch.sh +++ b/.github/actions/ensure-release-branch/ensure-release-branch.sh @@ -22,6 +22,7 @@ SCRIPT_DIR="$(dirname -- "$( readlink -f -- "$0"; )")" # Parse arguments ALLOW_MODIFY="" TAG="" +RELEASE_BRANCH="" while [[ $# -gt 0 ]]; do case $1 in @@ -29,6 +30,11 @@ while [[ $# -gt 0 ]]; do ALLOW_MODIFY=1 shift ;; + --release-branch) + RELEASE_BRANCH="$2" + shift + shift + ;; -*) echo "Error: Unknown option $1" exit 1 @@ -47,7 +53,7 @@ done if [ -z "$TAG" ]; then echo "Error: TAG is required as argument" - echo "Usage: $0 [--allow-modify] " + echo "Usage: $0 [--allow-modify] [--release-branch BRANCH] " exit 1 fi @@ -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"