Skip to content

Commit 002db87

Browse files
authored
Fix bugs in git workflow script (#5)
- The version compare function doesn't support `v` prefix. - A delay is required between pushing tag and watching github action. Hopefully 0.7 seconds will do.
1 parent 71d43f2 commit 002db87

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

gwf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ main(){
7070
watch) watch_latest ;;
7171
release)
7272
tag_main ${@:2} || return 1
73+
sleep 0.7 # give github action time to start
7374
watch_latest
7475
;;
7576
save) apply_dev_to_grit ;;
@@ -104,8 +105,7 @@ tag_main(){
104105
local patches
105106
patches="$(
106107
git tag --sort=-v:refname -n --list "v[0-9]*" |
107-
awk -F. 'NR=1{major=$1;minor=$2}$1==major&&$2==minor{print;next}{exit}' |
108-
tac
108+
awk -F. 'NR=1{major=$1;minor=$2}$1==major&&$2==minor{print;next}{exit}'
109109
)"
110110
local next_patch
111111
next_patch="$(
@@ -124,7 +124,7 @@ tag_main(){
124124
fi
125125
version=v${version#v}
126126
autoload -Uz is-at-least
127-
is-at-least $next_patch $version || {
127+
is-at-least ${next_patch#v} ${version#v} || {
128128
print -u2 "❌ Aborting: version must be at least $next_patch"
129129
return 2
130130
}

0 commit comments

Comments
 (0)