File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,20 @@ jobs:
42
42
run : |
43
43
cd server
44
44
# Print all tags
45
- git log --decorate --oneline | egrep '^[0-9a-f]+ \((HEAD, )? tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'
45
+ git log --decorate --oneline | egrep 'tag: ' | sed -r 's/^.+tag: ([^,\) ]+)[,\)].+$/\1/g'
46
46
# Get the current tag
47
- TAGS=$(git log --decorate --oneline | egrep '^[0-9a-f]+ \((HEAD, )? tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g')
47
+ TAGS=$(git log --decorate --oneline | egrep 'tag: ' | sed -r 's/^.+tag: ([^,\) ]+)[,\)].+$/\1/g')
48
48
CURRENT_TAG=$(echo "$TAGS" | head -n 1)
49
- # Get the previous tag that is not an rc, beta or alpha
50
- PREVIOUS_TAG=$(echo "$TAGS" | grep -v 'rc\|beta\|alpha' | sed -n '2p')
49
+
50
+ # Get the previous tag - filter pre-releases only if current tag is stable
51
+ if echo "$CURRENT_TAG" | grep -q 'rc\|beta\|alpha'; then
52
+ # Current tag is pre-release, don't filter
53
+ PREVIOUS_TAG=$(echo "$TAGS" | sed -n '2p')
54
+ else
55
+ # Current tag is stable, filter out pre-releases
56
+ PREVIOUS_TAG=$(echo "$TAGS" | grep -v 'rc\|beta\|alpha' | sed -n '2p')
57
+ fi
58
+
51
59
echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV
52
60
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
53
61
You can’t perform that action at this time.
0 commit comments