You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
Application/drone/deliver.sh

57 lines
1.2 KiB

#!/usr/bin/bash
TYPE="$1"
case "$DRONE_BRANCH" in
"production")
OPTIONS="--release"
;;
"")
echo '$DRONE_BRANCH not set' >&2
exit 1
;;
*)
OPTIONS="--debug"
;;
esac
case "$TYPE" in
"android")
OPTIONS="$OPTIONS -- --packageType=apk"
OUT_DIR="platforms/android/app/build/outputs/apk"
tree $OUT_DIR
#install gradle
wget -q https://services.gradle.org/distributions/gradle-7.5.1-bin.zip -P /tmp
unzip -d /opt/gradle /tmp/gradle-*.zip > /dev/null
export GRADLE_HOME=/opt/gradle/gradle-7.5.1/
echo $GRADLE_HOME
export PATH=$PATH:$GRADLE_HOME/bin
;;
"browser")
OUT_DIR="platforms/browser/www"
;;
"electron")
OUT_DIR="platforms/electron/build"
;;
*)
echo "unrecognized platform $TYPE." >&2
;;
esac
#install cordova
cordova platform add "$TYPE"
cordova build "$TYPE" $OPTIONS
echo "delivering outputs on server"
#prepare ssh / scp commands
curl https://codefirst.iut.uca.fr/git/Tactique-basket/Backend/raw/branch/dev/drone/prepare-deliver.sh > /tmp/prepare-deliver.sh
source /tmp/prepare-deliver.sh
SERV_DIR="$DIR/application/$TYPE"
echo "making delivery onto '$USER@$IP:$SERV_DIR'"
tree $OUT_DIR
scp -o "StrictHostKeyChecking no" -r "$OUT_DIR/" "$USER@$IP:$SERV_DIR"