File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -22,22 +22,27 @@ jobs:
22
22
run : |
23
23
git config user.name "Automated"
24
24
git config user.email "[email protected] "
25
-
26
25
- name : Check if stable branch exists
27
26
run : |
28
27
if ! git ls-remote --heads origin stable | grep stable; then
28
+ # Fetch all tags and sort them in descending order
29
+ LATEST_RELEASE=$(git tag | sort -Vr | head -n1)
30
+ # If no release is found, default to the main branch
31
+ if [ -z "$LATEST_RELEASE" ]; then
32
+ LATEST_RELEASE="main"
33
+ fi
34
+ # Check out the latest release or main branch
35
+ git checkout $LATEST_RELEASE
29
36
git checkout -b stable
30
37
git push -u origin stable
31
38
fi
32
-
33
39
- name : Handle Release
34
40
if : github.event_name == 'release'
35
41
run : |
36
42
git fetch --all
37
43
git checkout stable
38
44
git reset --hard ${GITHUB_REF#refs/tags/}
39
45
git push origin stable --force
40
-
41
46
- name : Handle Commit to Main
42
47
if : contains(github.event.head_commit.message, '!stable-docs')
43
48
run : |
You can’t perform that action at this time.
0 commit comments