build: cargo audit && copy binary instead of moving

This commit is contained in:
zhom
2025-06-05 23:25:43 +04:00
parent 5747729e30
commit de9c47241a
7 changed files with 47 additions and 37 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ jobs:
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
pnpm run build:linux-x64
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
pnpm run build:aarch64
pnpm run build:mac-aarch64
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
pnpm run build:win-x64
fi
+4 -4
View File
@@ -50,19 +50,19 @@ jobs:
arch: "aarch64"
target: "aarch64-apple-darwin"
pkg_target: "latest-macos-arm64"
nodecar_script: "build:aarch64"
nodecar_script: "build:mac-aarch64"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin"
arch: "x86_64"
target: "x86_64-apple-darwin"
pkg_target: "latest-macos-x64"
nodecar_script: "build:x86_64"
nodecar_script: "build:mac-x86_64"
- platform: "macos-latest"
args: "--target universal-apple-darwin"
arch: "aarch64"
target: "aarch64-apple-darwin,x86_64-apple-darwin"
target: "aarch64-apple-darwin"
pkg_target: "universal"
nodecar_script: "build:universal"
nodecar_script: "build:mac-universal"
- platform: "ubuntu-20.04"
args: "--target x86_64-unknown-linux-gnu"
arch: "x86_64"
+3 -3
View File
@@ -49,19 +49,19 @@ jobs:
arch: "aarch64"
target: "aarch64-apple-darwin"
pkg_target: "latest-macos-arm64"
nodecar_script: "build:aarch64"
nodecar_script: "build:mac-aarch64"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin"
arch: "x86_64"
target: "x86_64-apple-darwin"
pkg_target: "latest-macos-x64"
nodecar_script: "build:x86_64"
nodecar_script: "build:mac-x86_64"
- platform: "macos-latest"
args: "--target universal-apple-darwin"
arch: "aarch64"
target: "aarch64-apple-darwin,x86_64-apple-darwin"
pkg_target: "universal"
nodecar_script: "build:universal"
nodecar_script: "build:mac-universal"
- platform: "ubuntu-20.04"
args: "--target x86_64-unknown-linux-gnu"
arch: "x86_64"
+5
View File
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"appindicator",
"applescript",
"autoconfig",
"autologin",
@@ -22,7 +23,11 @@
"idletime",
"KHTML",
"launchservices",
"libayatana",
"librsvg",
"libwebkit",
"mountpoint",
"msvc",
"msys",
"Mullvad",
"nodecar",
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Determine file extension based on platform
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then
EXT=".exe"
else
EXT=""
fi
# If architecture provided in the command line, use it to rename the binary in TARGET_TRIPLE
if [ -n "$1" ]; then
TARGET_TRIPLE="$1"
else
RUST_INFO=$(rustc -vV)
TARGET_TRIPLE=$(echo "$RUST_INFO" | grep -o 'host: [^ ]*' | cut -d' ' -f2)
fi
# Check if target triple was found
if [ -z "$TARGET_TRIPLE" ]; then
echo "Failed to determine platform target triple" >&2
exit 1
fi
# Copy the file
cp "dist/nodecar${EXT}" "../src-tauri/binaries/nodecar-${TARGET_TRIPLE}${EXT}"
+9 -8
View File
@@ -7,14 +7,15 @@
"watch": "nodemon --exec ts-node --esm ./src/index.ts --watch src",
"dev": "node --loader ts-node/esm ./src/index.ts",
"start": "node --loader ts-node/esm ./src/index.ts",
"build": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar",
"build:aarch64": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar",
"build:x86_64": "tsc && pkg ./dist/index.js --targets latest-macos-x64 --output dist/nodecar",
"build:universal": "pnpm build:aarch64 && pnpm build:x86_64",
"build:linux-x64": "tsc && pkg ./dist/index.js --targets latest-linux-x64 --output dist/nodecar",
"build:linux-arm64": "tsc && pkg ./dist/index.js --targets latest-linux-arm64 --output dist/nodecar",
"build:win-x64": "tsc && pkg ./dist/index.js --targets latest-win-x64 --output dist/nodecar",
"build:win-arm64": "tsc && pkg ./dist/index.js --targets latest-win-arm64 --output dist/nodecar"
"rename-binary": "sh ./rename-binary.sh",
"build": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar && pnpm rename-binary",
"build:mac-aarch64": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar && pnpm rename-binary",
"build:mac-x86_64": "tsc && pkg ./dist/index.js --targets latest-macos-x64 --output dist/nodecar && pnpm rename-binary",
"build:mac-universal": "pnpm build:mac-aarch64 && pnpm rename-binary && pnpm build:mac-x86_64 && pnpm rename-binary x86_64-apple-darwin",
"build:linux-x64": "tsc && pkg ./dist/index.js --targets latest-linux-x64 --output dist/nodecar && pnpm rename-binary",
"build:linux-arm64": "tsc && pkg ./dist/index.js --targets latest-linux-arm64 --output dist/nodecar && pnpm rename-binary",
"build:win-x64": "tsc && pkg ./dist/index.js --targets latest-win-x64 --output dist/nodecar && pnpm rename-binary",
"build:win-arm64": "tsc && pkg ./dist/index.js --targets latest-win-arm64 --output dist/nodecar && pnpm rename-binary"
},
"keywords": [],
"author": "",
-21
View File
@@ -1,21 +0,0 @@
#!/bin/bash
# Determine file extension based on platform
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then
EXT=".exe"
else
EXT=""
fi
# Get Rust target triple
RUST_INFO=$(rustc -vV)
TARGET_TRIPLE=$(echo "$RUST_INFO" | grep -o 'host: [^ ]*' | cut -d' ' -f2)
# Check if target triple was found
if [ -z "$TARGET_TRIPLE" ]; then
echo "Failed to determine platform target triple" >&2
exit 1
fi
# Rename the file
mv "nodecar/dist/nodecar${EXT}" "src-tauri/binaries/nodecar-${TARGET_TRIPLE}${EXT}"