Skip to content

Commit f15707b

Browse files
fix builds
1 parent b9c2236 commit f15707b

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,32 @@ jobs:
4848
- name: Install dependencies
4949
run: cabal update
5050

51-
- name: Build executable
51+
- name: Build executable on Linux or macOS
52+
if: runner.os != 'Windows'
5253
run: |
5354
cabal build
5455
mkdir -p dist
55-
if [ "${{ runner.os }}" == "Windows" ]; then
56-
$BIN_PATH = cabal list-bin json-to-sql-exe
57-
if (Test-Path $BIN_PATH) {
58-
Copy-Item $BIN_PATH dist/json-to-sql-windows.exe
59-
} else {
60-
Write-Error "Error: Executable not found!"
61-
exit 1
62-
}
56+
BIN_PATH=$(cabal list-bin json-to-sql-exe)
57+
if [[ -f "$BIN_PATH" ]]; then
58+
cp "$BIN_PATH" dist/json-to-sql-${{ runner.os == 'Linux' && 'linux' || 'macos' }}
6359
else
64-
BIN_PATH=$(cabal list-bin json-to-sql-exe)
65-
if [[ -f "$BIN_PATH" ]]; then
66-
cp "$BIN_PATH" dist/json-to-sql-${{ runner.os == 'Linux' && 'linux' || 'macos' }}
67-
else
68-
echo "Error: Executable not found!"
69-
exit 1
70-
fi
60+
echo "Error: Executable not found!"
61+
exit 1
7162
fi
7263
64+
- name: Build executable on Windows
65+
if: runner.os == 'Windows'
66+
run: |
67+
cabal build
68+
mkdir -p dist
69+
BIN_PATH=$(cabal list-bin json-to-sql-exe)
70+
if (Test-Path $BIN_PATH) {
71+
Copy-Item $BIN_PATH dist/json-to-sql-windows.exe
72+
} else {
73+
Write-Error "Error: Executable not found!"
74+
exit 1
75+
}
76+
7377
- name: Upload built executables
7478
uses: actions/upload-artifact@v4
7579
with:

0 commit comments

Comments
 (0)