forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-desktop.sh
executable file
·38 lines (32 loc) · 1.12 KB
/
build-desktop.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
#!/bin/bash
set -e
export ELECTRON_ENV=${1:-development}
if [[ "$ELECTRON_ENV" == "staging" ]]; then
ENV_FILE=".env.staging"
elif [[ "$ELECTRON_ENV" == "adhoc" ]]; then
ENV_FILE=".env.adhoc"
elif [[ "$ELECTRON_ENV" == "production" ]]; then
ENV_FILE=".env.production"
else
ENV_FILE=".env"
fi
if [[ -n "$GCP_GEOLOCATION_API_KEY" ]]; then
if grep -qE "^GCP_GEOLOCATION_API_KEY=" "$ENV_FILE"; then
# Replace the value for the existing key
sed -i "s|^GCP_GEOLOCATION_API_KEY=.*$|GCP_GEOLOCATION_API_KEY=$GCP_GEOLOCATION_API_KEY|g" "$ENV_FILE"
else
# Add the key-value pair to the config file
echo "GCP_GEOLOCATION_API_KEY=$GCP_GEOLOCATION_API_KEY" >> "$ENV_FILE"
fi
fi
SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")
source "$SCRIPTS_DIR/shellUtils.sh"
title "Bundling Desktop js Bundle Using Webpack"
info " • ELECTRON_ENV: $ELECTRON_ENV"
info " • ENV file: $ENV_FILE"
info ""
npx webpack --config config/webpack/webpack.desktop.ts --env file=$ENV_FILE
title "Building Desktop App Archive Using Electron"
info ""
shift 1
npx electron-builder --config config/electronBuilder.config.js --publish always "$@"