Skip to content

Commit

Permalink
source .env in build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdenasser committed Nov 5, 2024
1 parent 35219c9 commit 36371d3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
48 changes: 27 additions & 21 deletions build-universal.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
#!/bin/bash
# source .env for notarization credentials
echo "Sourcing .env..."
if [ -f .env ]; then
source .env
# Verify that required environment variables are set
if [ -z "$APPLE_ID" ] || [ -z "$APPLE_PASSWORD" ] || [ -z "$APPLE_TEAM_ID" ]; then
echo "Error: Required environment variables are not set"
echo "Please ensure your .env file contains:"
echo "[email protected]"
echo "APPLE_PASSWORD=your-app-specific-password"
echo "APPLE_TEAM_ID=your-team-id"
exit 1
fi
# Export the variables so they are available to child processes
export APPLE_ID
export APPLE_PASSWORD
export APPLE_TEAM_ID
else
echo "Error: .env file not found"
echo "Please create a .env file with the following variables:"
echo "[email protected]"
echo "APPLE_PASSWORD=your-app-specific-password"
echo "APPLE_TEAM_ID=your-team-id"
exit 1
fi

# Build frontend
npm run build

# Build for Intel
echo "Building for x86_64..."
npm run tauri build -- --target x86_64-apple-darwin
npm run tauri build -- --target x86_64-apple-darwin --bundles dmg

# Build for Apple Silicon
echo "Building for aarch64..."
npm run tauri build -- --target aarch64-apple-darwin
npm run tauri build -- --target aarch64-apple-darwin --bundles dmg

# Create universal binary directory
mkdir -p src-tauri/target/universal-apple-darwin/release

# Create universal binary
echo "Creating universal binary..."
lipo "src-tauri/target/x86_64-apple-darwin/release/macos-task-manager" \
"src-tauri/target/aarch64-apple-darwin/release/macos-task-manager" \
-create -output "src-tauri/target/universal-apple-darwin/release/macos-task-manager"

# Create universal app bundle
echo "Creating universal app bundle..."
cp -r "src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/NeoHtop.app" \
"src-tauri/target/universal-apple-darwin/release/"

# Replace the binary in the app bundle
cp "src-tauri/target/universal-apple-darwin/release/macos-task-manager" \
"src-tauri/target/universal-apple-darwin/release/NeoHtop.app/Contents/MacOS/"

echo "Universal build complete!"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macos-task-manager",
"version": "0.1.0",
"version": "0.1.2",
"description": "",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "macos-task-manager"
version = "0.1.0"
version = "0.1.2"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "NeoHtop",
"version": "0.1.0"
"version": "0.1.2"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 36371d3

Please sign in to comment.