-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
65 lines (49 loc) · 1.66 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
VERSION=$(jq -r .version <package.json)
echo "Building version: $VERSION"
mkdir -p dist/{out,logs}
BUILD_PATH="$(pwd)/dist"
PLATFORMS=(
"linux-x64:linux-x64-baseline"
"linux-arm64:linux-arm64"
"windows-x64:windows-x64-baseline"
"darwin-x64:darwin-x64"
"darwin-arm64:darwin-arm64"
)
echo "Installing dependencies..."
bun install
for platform in "${PLATFORMS[@]}"; do
IFS=":" read -r version target <<<"$platform"
echo "Building for $version (target: bun-$target)..."
BINARY_NAME="aqua-speed-${version}_v${VERSION}"
if [[ "$version" == *"windows"* ]]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
if [[ "$version" == *"linux"* ]]; then
ARCHIVE_NAME="aqua-speed-${version}_v${VERSION}.tar.xz"
else
ARCHIVE_NAME="aqua-speed-${version}_v${VERSION}.zip"
fi
bun build --compile --sourcemap --minify --bytecode \
--target="bun-$target" \
./src/cli.ts \
--outfile "$BUILD_PATH/out/$BINARY_NAME"
pushd "$BUILD_PATH/out" >/dev/null
sha1sum "$BINARY_NAME" >checksum.txt
if [[ "$version" == *"linux"* ]]; then
# tar -c -I 'xz -5 -T0' -f "$ARCHIVE_NAME" "$BINARY_NAME" checksum.txt
tar -cJf "$ARCHIVE_NAME" "$BINARY_NAME" checksum.txt
else
zip -j "$ARCHIVE_NAME" "$BINARY_NAME" checksum.txt
fi
cp checksum.txt "${BINARY_NAME}.checksum.txt"
rm -f "$BINARY_NAME" checksum.txt
popd >/dev/null
echo "Completed build for $version"
done
echo "Consolidating checksums..."
cat dist/out/*.checksum.txt >dist/out/checksums.txt
rm dist/out/*.checksum.txt
echo "Build complete! Artifacts are in dist/out/"
ls -la dist/out/