@@ -26,16 +26,17 @@ runs:
2626 # Function to extract version from anchor.toml
2727 extract_from_anchor_toml() {
2828 local key=$1
29+ local version=""
2930 # Try both uppercase and lowercase variants
3031 if [ -f "Anchor.toml" ]; then
31- echo "Found Anchor.toml in current directory"
32+ echo "Found Anchor.toml in current directory" >&2
3233 version=$(grep -i "^${key}_version *= *\".*\"" Anchor.toml | cut -d'"' -f2)
3334 if [ -n "$version" ]; then
3435 echo "$version"
3536 return 0
3637 fi
3738 elif [ -f "anchor.toml" ]; then
38- echo "Found anchor.toml in current directory"
39+ echo "Found anchor.toml in current directory" >&2
3940 version=$(grep -i "^${key}_version *= *\".*\"" anchor.toml | cut -d'"' -f2)
4041 if [ -n "$version" ]; then
4142 echo "$version"
4546 else
4647 anchor_toml=$(find . -iname "anchor.toml" -type f | head -n 1)
4748 if [ -n "$anchor_toml" ]; then
48- echo "Found anchor.toml at: $anchor_toml"
49+ echo "Found anchor.toml at: $anchor_toml" >&2
4950 version=$(grep -i "^${key}_version *= *\".*\"" "$anchor_toml" | cut -d'"' -f2)
5051 if [ -n "$version" ]; then
5152 echo "$version"
8081 fi
8182 fi
8283 fi
83- echo "solana_version=${SOLANA_VERSION}" >> $GITHUB_OUTPUT
84- echo "SOLANA_VERSION=${SOLANA_VERSION}" >> $GITHUB_ENV
84+
85+ # Ensure clean version output
86+ if [ -n "${SOLANA_VERSION}" ]; then
87+ # Remove any newlines and ensure we only have the version
88+ SOLANA_VERSION=$(echo "${SOLANA_VERSION}" | tr -d '\n' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
89+ echo "solana_version=${SOLANA_VERSION}" >> $GITHUB_OUTPUT
90+ echo "SOLANA_VERSION=${SOLANA_VERSION}" >> $GITHUB_ENV
91+ fi
8592
8693 # Extract Anchor version
8794 if [ -n "${{ github.event.inputs.anchor_version }}" ]; then
@@ -108,7 +115,10 @@ runs:
108115 fi
109116 fi
110117
118+ # Ensure clean version output
111119 if [ -n "${ANCHOR_VERSION}" ]; then
120+ # Remove any newlines and ensure we only have the version
121+ ANCHOR_VERSION=$(echo "${ANCHOR_VERSION}" | tr -d '\n' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
112122 echo "anchor_version=${ANCHOR_VERSION}" >> $GITHUB_OUTPUT
113123 echo "ANCHOR_VERSION=${ANCHOR_VERSION}" >> $GITHUB_ENV
114124 fi