-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
62 lines (52 loc) · 1.54 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
#!/bin/bash
# Load environment variables from .env file
export $(grep -v '^#' .env | xargs)
# Default description
DESCRIPTION=""
# Parse optional argument for description
while getopts m: flag
do
case "${flag}" in
m) DESCRIPTION=${OPTARG};;
esac
done
# Clean out release/ directory if it exists, otherwise create it
if [ -d "release" ]; then
rm -rf release/*
else
mkdir release
fi
# Run the Tauri build
cargo tauri build
# Extract version from src-tauri/tauri.conf.json
VERSION=$(grep -Po '"version": *"\K[^"]*' src-tauri/tauri.conf.json)
# Get the signature from the generated file
SIGNATURE_FILE="src-tauri/target/release/bundle/nsis/stargazer_${VERSION}_x64-setup.exe.sig"
if [ -f "$SIGNATURE_FILE" ]; then
SIGNATURE=$(cat "$SIGNATURE_FILE")
else
echo "Error: Signature file not found at $SIGNATURE_FILE"
exit 1
fi
# Generate the latest.json file and place it in release/
cat <<EOF > release/latest.json
{
"version": "$VERSION",
"notes": "$DESCRIPTION",
"platforms": {
"windows-x86_64": {
"signature": "$SIGNATURE",
"url": "https://github.com/henrymbaldwin/orion_api_stargazer/releases/latest/download/stargazer_${VERSION}_x64-setup.exe"
}
}
}
EOF
# Copy the generated executable to release/
EXE_FILE="src-tauri/target/release/bundle/nsis/stargazer_${VERSION}_x64-setup.exe"
if [ -f "$EXE_FILE" ]; then
cp "$EXE_FILE" release/
else
echo "Error: Executable file not found at $EXE_FILE"
exit 1
fi
echo "Build complete, latest.json and executable copied to release/"