Skip to content

Commit 2fa77aa

Browse files
committed
finx: npm configuration for build workflow
Signed-off-by: rafaeljohn9 <[email protected]>
1 parent 2b9e4e0 commit 2fa77aa

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,34 @@ jobs:
8383
cp target/${{ matrix.build.TARGET }}/release/gh-templates $BINARY
8484
chmod +x $BINARY
8585
fi
86-
8786
echo "BINARY=$BINARY" >> $GITHUB_ENV
8887
89-
# Prepare npm + python packages (still generic inside folders)
88+
# Prepare npm + python packages
9089
mkdir -p npm/bin python/gh_templates_bin
90+
91+
# For npm, copy the platform-specific binary but also create a generic named version
9192
cp $BINARY npm/bin/
92-
cp $BINARY python/gh_templates_bin/
93+
if [[ "${{ matrix.build.TARGET }}" == *"windows"* ]]; then
94+
cp $BINARY npm/bin/gh-templates.exe
95+
else
96+
cp $BINARY npm/bin/gh-templates
97+
fi
9398
94-
# npm package.json
99+
# For python, use the generic name since the wrapper handles execution
100+
if [[ "${{ matrix.build.TARGET }}" == *"windows"* ]]; then
101+
cp $BINARY python/gh_templates_bin/gh-templates.exe
102+
else
103+
cp $BINARY python/gh_templates_bin/gh-templates
104+
fi
105+
106+
# npm package.json - reference generic binary name
95107
cat > npm/package.json << EOF
96108
{
97109
"name": "@rafaeljohn9/gh-templates-${{ matrix.build.NAME }}",
98110
"version": "$VERSION",
99-
"bin": { "gh-templates": "./bin/$BINARY" },
111+
"bin": {
112+
"gh-templates": "./bin/gh-templates$([[ "${{ matrix.build.TARGET }}" == *"windows"* ]] && echo ".exe" || echo "")"
113+
},
100114
"files": ["bin/"],
101115
"license": "APACHE-2.0"
102116
}
@@ -114,7 +128,6 @@ jobs:
114128
license='APACHE-2.0'
115129
)
116130
EOF
117-
118131
# Python __init__.py
119132
cat > python/gh_templates_bin/__init__.py << 'EOF'
120133
import os, sys, subprocess

0 commit comments

Comments
 (0)