Skip to content

Commit 487d4ca

Browse files
committed
account for uppercase anchor toml
1 parent 1458792 commit 487d4ca

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

extract-versions/action.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,34 @@ runs:
1919
echo "Current directory: $(pwd)"
2020
echo "Directory contents:"
2121
ls -la
22-
echo "Looking for anchor.toml..."
23-
find . -name "anchor.toml" || echo "No anchor.toml found in directory tree"
22+
echo "Looking for Anchor.toml/anchor.toml..."
23+
find . -iname "anchor.toml" || echo "No anchor.toml found in directory tree"
2424
echo "======================="
2525
2626
# Function to extract version from anchor.toml
2727
extract_from_anchor_toml() {
2828
local key=$1
29-
# First try current directory
30-
if [ -f "anchor.toml" ]; then
29+
# Try both uppercase and lowercase variants
30+
if [ -f "Anchor.toml" ]; then
31+
echo "Found Anchor.toml in current directory"
32+
version=$(grep -i "^${key}_version *= *\".*\"" Anchor.toml | cut -d'"' -f2)
33+
if [ -n "$version" ]; then
34+
echo "$version"
35+
return 0
36+
fi
37+
elif [ -f "anchor.toml" ]; then
3138
echo "Found anchor.toml in current directory"
32-
version=$(grep "^${key}_version *= *\".*\"" anchor.toml | cut -d'"' -f2)
39+
version=$(grep -i "^${key}_version *= *\".*\"" anchor.toml | cut -d'"' -f2)
3340
if [ -n "$version" ]; then
3441
echo "$version"
3542
return 0
3643
fi
3744
# Then try to find it in subdirectories
3845
else
39-
anchor_toml=$(find . -name "anchor.toml" -type f | head -n 1)
46+
anchor_toml=$(find . -iname "anchor.toml" -type f | head -n 1)
4047
if [ -n "$anchor_toml" ]; then
4148
echo "Found anchor.toml at: $anchor_toml"
42-
version=$(grep "^${key}_version *= *\".*\"" "$anchor_toml" | cut -d'"' -f2)
49+
version=$(grep -i "^${key}_version *= *\".*\"" "$anchor_toml" | cut -d'"' -f2)
4350
if [ -n "$version" ]; then
4451
echo "$version"
4552
return 0

0 commit comments

Comments
 (0)