-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.sh
executable file
·53 lines (46 loc) · 1.5 KB
/
deploy.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
#!/bin/bash
# check arg number
check_args () {
if [ "$#" -ne 2 ]; then
echo "Usage: $0 user host"
exit 1
fi
}
# build and deploy for macos
build_deploy_mac() {
local user="$1"
local host="$2"
echo "Starting Build and Deploy for MacOS..."
flutter build macos --release
rm build/macos/Build/Products/Release/chitchat.dmg
hdiutil create -format UDZO -srcfolder build/macos/Build/Products/Release/chitchat.app build/macos/Build/Products/Release/chitchat.dmg
cp build/macos/Build/Products/Release/chitchat.dmg ~/Downloads
scp ~/Downloads/chitchat.dmg "${user}@${host}:/mnt/backup_ssf/chitchat/download/"
echo "MacOS Build and Deploy Complete."
}
# build and deploy for web
build_deploy_web() {
local user="$1"
local host="$2"
echo "Starting Build and Deploy for Web..."
flutter build web
gsed -i "/base href=\"\/\"/s/\//.\//g" build/web/index.html
cp -a build/web website/
scp -r website/* "${user}@${host}:/mnt/backup_ssf/chitchat/"
echo "Web Build and Deploy Complete."
}
# build and deploy for android
build_deploy_android() {
local user="$1"
local host="$2"
echo "Starting Build and Deploy for Android..."
flutter build apk --release
flutter build appbundle --release
scp build/app/outputs/flutter-apk/app-release.apk ${user}@${host}:/mnt/backup_ssf/chitchat/download/
echo "Android Build and Deploy Complete."
}
# Main
check_args "$@"
#build_deploy_mac "$@"
build_deploy_web "$@"
#build_deploy_android "$@"