File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,23 @@ jobs:
2121 ref : ${{ github.ref }}
2222 token : ${{ github.token }}
2323
24- - name : Extract version from branch name
24+ - name : Extract version from branch name (normalize to x.y.z)
2525 run : |
2626 BRANCH_NAME="${GITHUB_REF_NAME}"
27- VERSION="${BRANCH_NAME#release/}"
27+ RAW_VERSION="${BRANCH_NAME#release/}"
28+
29+ IFS='.' read -ra PARTS <<< "$RAW_VERSION"
30+
31+ while [ "${#PARTS[@]}" -lt 3 ]; do
32+ PARTS+=("0")
33+ done
34+
35+ VERSION="${PARTS[0]}.${PARTS[1]}.${PARTS[2]}"
36+
37+ echo "RAW_VERSION=$RAW_VERSION" >> $GITHUB_ENV
2838 echo "VERSION=$VERSION" >> $GITHUB_ENV
2939 echo "RELEASE_BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
30- echo "UPDATE_BRANCH=updateversion/$VERSION " >> $GITHUB_ENV
40+ echo "UPDATE_BRANCH=updateversion/$RAW_VERSION " >> " $GITHUB_ENV"
3141
3242 - name : Create updateversion branch
3343 run : |
6474 gh pr create \
6575 --base "${{ env.RELEASE_BRANCH }}" \
6676 --head "${{ env.UPDATE_BRANCH }}" \
67- --title "[${{ env.VERSION }}] Update version to ${{ env.VERSION }}" \
77+ --title "[${{ env.RAW_VERSION }}] Update version to ${{ env.VERSION }}" \
6878 --body "This PR was automatically opened by a GitHub action on creation of a release branch (\`${{ env.RELEASE_BRANCH }}\`).
6979 Review the version update and merge if correct, otherwise update the version manually." \
7080 --draft
You can’t perform that action at this time.
0 commit comments