Skip to content

Commit d05390b

Browse files
committed
Update checkout-latest-filament
1 parent ad44f7d commit d05390b

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

docs/bin/checkout-latest-filament

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,26 @@ DOCS_VERSIONS=(
88
)
99

1010
for v in "${DOCS_VERSIONS[@]}"; do
11+
major="${v%%.*}" # 1, 2, 3, 4
12+
1113
if [ -d "filament/$v" ]; then
12-
echo "Pulling latest documentation updates for $v..."
13-
(cd filament/$v && git pull)
14+
echo "Updating $v..."
15+
(cd filament/$v && git fetch --tags origin)
1416
else
1517
echo "Cloning $v..."
16-
git clone --single-branch --branch "$v" [email protected]:filamentphp/filament.git "filament/$v"
17-
fi;
18+
git clone --no-checkout [email protected]:filamentphp/filament.git "filament/$v"
19+
(cd filament/$v && git fetch --tags origin)
20+
fi
21+
22+
latest_tag=$(git -C filament/$v tag -l "v${major}.*" --sort=-v:refname \
23+
| grep -E '^[^ -]+$' \
24+
| head -n1)
25+
26+
if [ -z "$latest_tag" ]; then
27+
echo "No stable tag found for $v"
28+
continue
29+
fi
30+
31+
echo "Checking out $latest_tag for $v..."
32+
(cd filament/$v && git checkout -f "$latest_tag")
1833
done

0 commit comments

Comments
 (0)