Skip to content

Commit f99aa9e

Browse files
committed
fix platform/arch
1 parent 5f4e612 commit f99aa9e

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

.github/workflows/build_parsers.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,29 @@ jobs:
3939
run: |
4040
tsdl build
4141
42-
- name: Rename built parsers to include platform
42+
- name: Rename built parsers to include platform and architecture
4343
run: |
44-
for dir in parsers/*; do
45-
if [ -d "$dir/src" ]; then
46-
lib_dir="$dir/src"
47-
cd "$lib_dir"
48-
for file in *; do
49-
if [ -f "$file" ]; then
50-
extension="${file##*.}"
51-
base="${file%.*}"
52-
mv "$file" "${base}-${{ matrix.platform }}.${extension}"
53-
fi
54-
done
55-
cd - > /dev/null
44+
# Determine architecture
45+
arch=$(uname -m)
46+
# Map architecture names to standard values
47+
if [[ "$arch" == "x86_64" ]]; then
48+
arch="x86_64"
49+
elif [[ "$arch" == "arm64" || "$arch" == "aarch64" ]]; then
50+
arch="arm64"
51+
fi
52+
# For macOS, adjust platform name
53+
if [[ "${{ matrix.platform }}" == "macos" ]]; then
54+
platform_name="darwin"
55+
else
56+
platform_name="${{ matrix.platform }}"
57+
fi
58+
platform_arch="${platform_name}-${arch}"
59+
# Rename parser files
60+
for file in parsers/libtree-sitter-*; do
61+
if [ -f "$file" ]; then
62+
extension="${file##*.}"
63+
base="${file%.*}"
64+
mv "$file" "${base}-${platform_arch}.${extension}"
5665
fi
5766
done
5867
@@ -79,7 +88,7 @@ jobs:
7988
- name: Commit changes
8089
if: steps.changes.outputs.changes == 'true'
8190
run: |
82-
git commit -m "Build tree-sitter parsers for ${{ matrix.platform }} [skip ci]"
91+
git commit -m "Build tree-sitter parsers for ${{ matrix.platform }}-${arch} [skip ci]"
8392
8493
- name: Push changes
8594
if: steps.changes.outputs.changes == 'true'

0 commit comments

Comments
 (0)