Skip to content

Commit 9debdd5

Browse files
committed
fix: update ch db setup script
1 parent 25b5b01 commit 9debdd5

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/release.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ jobs:
1414
include:
1515
- platform: 'macos-latest' # for Arm based macs (M1 and above).
1616
args: '--target aarch64-apple-darwin'
17+
arch: 'arm64'
1718
- platform: 'macos-latest' # for Intel based macs.
1819
args: '--target x86_64-apple-darwin'
20+
arch: 'x86_64'
1921
- platform: 'ubuntu-22.04' # for Linux using ubuntu distribution.
2022
args: ''
23+
arch: ''
2124

2225
runs-on: ${{ matrix.platform }}
2326
steps:
@@ -33,6 +36,8 @@ jobs:
3336
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
3437
- name: install chdb library
3538
run: sh ./src-tauri/update_libchdb.sh
39+
env:
40+
ARCH: ${{ matrix.arch }}
3641
- name: install frontend dependencies
3742
run: npm ci
3843
- uses: tauri-apps/tauri-action@v0

src-tauri/update_libchdb.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,30 @@ set -e
33
cd $(dirname "${BASH_SOURCE[0]}")
44

55
# Get the newest release version
6-
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/chdb-io/chdb/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
6+
RESPONSE=$(curl --silent --fail "https://api.github.com/repos/chdb-io/chdb/releases/latest")
7+
if [ $? -ne 0 ]; then
8+
echo "Failed to fetch from GitHub API"
9+
exit 1
10+
fi
11+
LATEST_RELEASE=$(echo "$RESPONSE" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
12+
713

814
echo "Latest version found: $LATEST_RELEASE"
915

16+
# Set ARCH to uname -m if not already set
17+
ARCH=${ARCH:-$(uname -m)}
18+
1019
# Download the correct version based on the platform
1120
case "$(uname -s)" in
1221
Linux)
13-
if [[ $(uname -m) == "aarch64" ]]; then
22+
if [[ $ARCH == "aarch64" ]]; then
1423
PLATFORM="linux-aarch64-libchdb.tar.gz"
1524
else
1625
PLATFORM="linux-x86_64-libchdb.tar.gz"
1726
fi
1827
;;
1928
Darwin)
20-
if [[ $(uname -m) == "arm64" ]]; then
29+
if [[ $ARCH == "arm64" ]]; then
2130
PLATFORM="macos-arm64-libchdb.tar.gz"
2231
else
2332
PLATFORM="macos-x86_64-libchdb.tar.gz"

0 commit comments

Comments
 (0)