@@ -43,10 +43,31 @@ jobs:
4343 uses : ' ./.github/actions/extract-version'
4444 with :
4545 branch-name : ${{ github.ref_name }}
46+ workflow-variables :
47+ name : ' Set workflow variables'
48+ needs : [versioning]
49+ runs-on : ubuntu-latest
50+ outputs :
51+ target-branch : ${{ steps.compose-target-branch.outputs.target-branch }}
52+ steps :
53+ - name : ' Compose target branch name'
54+ id : compose-target-branch
55+ run : |
56+ if [[ "${{ inputs.promotion-type }}" == "preview" ]]; then
57+ target_branch="preview/${{ needs.versioning.outputs.friendly-version }}"
58+ elif [[ "${{ inputs.promotion-type }}" == "release" ]]; then
59+ target_branch="release/${{ needs.versioning.outputs.friendly-version }}"
60+ fi
61+
62+ echo "Target branch: $target_branch"
63+
64+ echo "target-branch=$target_branch" >> $GITHUB_OUTPUT
4665 validate-promotion :
4766 name : ' Validate promotion'
48- needs : [versioning]
67+ needs : [ versioning, workflow-variables ]
4968 runs-on : ubuntu-latest
69+ outputs :
70+ target-branch : ${{ steps.compose-target-branch.outputs.target-branch }}
5071 steps :
5172 - name : ' Checkout ${{ github.head_ref || github.ref }}'
5273 uses : actions/checkout@v4
@@ -62,19 +83,11 @@ jobs:
6283 exit 1
6384 - name : ' Validate target branch'
6485 env :
65- target-branch : ' '
86+ target-branch : ${{ needs.workflow-variables.outputs.target-branch }}
6687 run : |
67- if [[ "${{ inputs.promotion-type }}" == "preview" ]]; then
68- target_branch=$(echo "target-branch=preview/${{ needs.versioning.outputs.friendly-version }}")
69- else
70- target_branch=$(echo "target-branch=release/${{ needs.versioning.outputs.friendly-version }}")
71- fi
72-
73- echo "Target branch: $target_branch
74-
75- git ls-remote --exit-code --heads origin $target_branch
88+ git ls-remote --exit-code --heads origin ${{ env.target-branch }}
7689
7790 if [[ $? -ne 0 ]]; then
78- echo "Target branch does not exist: $target_branch "
91+ echo "Target branch does not exist: ${{ env.target-branch }} "
7992 exit 1
8093 fi
0 commit comments