Skip to content

Commit

Permalink
fix set go env in windows
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <[email protected]>
  • Loading branch information
yankay committed Aug 15, 2024
1 parent 74f2755 commit 77c2634
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/test-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,37 @@ jobs:
<(sed -E 's/^go([0-9]+)[.]([0-9]+)([.]([0-9]+))?(([a-z]+)([0-9]+))?/\1.\2\n\4\n\6\n\7/i' \
<(curl -fsSL "https://go.dev/dl/?mode=json&include=all" | jq -rc .[0].version) \
)
echo "${norm[0]}"
echo "${norm[1]}"
echo "${norm[2]}"
echo "${norm[3]}"
# Serialize version, making sure we have a patch version, and separate possible rcX into .rc-X
[ "${norm[1]}" != "" ] || norm[1]="0"
norm[1]=".${norm[1]}"
[ "${norm[2]}" == "" ] || norm[2]="-${norm[2]}"
[ "${norm[3]}" == "" ] || norm[3]=".${norm[3]}"
if [ -n "${norm[3]}" ]; then
echo "norm3 meet"
length=${#norm[3]}
echo "Character length $length"
for ((i = 0; i < length; i++)); do
char="${norm[3]:i:1}"
echo "Character at position $i: $char"
ascii_value=$(printf "%d" "'$char")
echo "ASCII value of $char: $ascii_value"
done
norm[3]="${norm[3]//+([[:space:]])/}" # 移除所有空白字符
[ "${norm[3]}" == "" ] || norm[3]=".${norm[3]}"
fi
# Save it
IFS=
echo "GO_VERSION=${norm[*]}" >> $GITHUB_ENV
echo "${norm[0]}"
echo "${norm[1]}"
echo "${norm[2]}"
echo "${norm[3]}"
echo "${norm[*]}"
- uses: actions/[email protected]
with:
fetch-depth: 1
Expand Down

0 comments on commit 77c2634

Please sign in to comment.