Skip to content

Commit 3d51c5c

Browse files
committed
Merge branch 'main' into 2.1.x
2 parents b3c9b50 + 57f3338 commit 3d51c5c

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/workflows/tagged_release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ jobs:
102102
exit 1
103103
fi
104104
105+
- name: Prepare git branch
106+
run: |
107+
git fetch
108+
git ls-remote --exit-code --heads origin ${{ env.release_branch_name }} >/dev/null 2>&1
109+
EXIT_CODE=$?
110+
if [[ $EXIT_CODE == '0' ]]; then
111+
git checkout ${{ env.release_branch_name }}
112+
git pull
113+
elif [[ $EXIT_CODE == '2' ]]; then
114+
git checkout -b ${{ env.release_branch_name }}
115+
fi
116+
105117
- name: Set versions
106118
continue-on-error: true
107119
run: |
@@ -122,12 +134,17 @@ jobs:
122134
123135
- name: Create a release branch
124136
run: |
125-
git checkout -b ${{ env.release_branch_name }}
126137
git add documentation/python-sdk-guide/antora.yml
127138
git add core/esmf-aspect-meta-model-python/pyproject.toml
128139
git commit -m "Release version ${{steps.ESMF_version.outputs.EsmfVersion}}."
129-
git push --set-upstream origin ${{ env.release_branch_name }}
130-
tag_version=v${{ github.event.inputs.release_version }}
140+
git ls-remote --exit-code --heads origin ${{ env.release_branch_name }} >/dev/null 2>&1
141+
EXIT_CODE=$?
142+
if [[ $EXIT_CODE == '0' ]]; then
143+
git push
144+
elif [[ $EXIT_CODE == '2' ]]; then
145+
git push --set-upstream origin ${{ env.release_branch_name }}
146+
fi
147+
tag_version=v${{ github.event.inputs.release_version }}
131148
git tag $tag_version
132149
git push origin $tag_version
133150

0 commit comments

Comments
 (0)