-
Notifications
You must be signed in to change notification settings - Fork 223
/
fir.sh
executable file
·46 lines (39 loc) · 970 Bytes
/
fir.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
#!/bin/sh
# because fir-cli dependent ruby enviroment, this shell is dependent ruby docker
# so xcode and gradle not use
# this shell only use to publish apk or ipa , build is not run
# fir publish **.apk
# echo $(curl https://raw.githubusercontent.com/FIRHQ/fir-cli/master/fir.sh) > /usr/local/bin/fir
mountFolder=$HOME/fir-cli/data
destFolder=/fir-cli
mkdir -p $mountFolder
# find path file name
function findFileName() {
echo ${1##*/}
}
# move file to mount folder
tmpFiles=()
cmds=()
for i in $@; do
if [ -d $i ];then
cp -r $i $mountFolder
elif [ -f $i ];then
cp $i $mountFolder
else
cmds+=($i)
continue
fi
destFile=$destFolder/$(findFileName $i)
cmds+=($destFile)
tmpFiles+=($mountFolder/$(findFileName $i))
done
# start docker to run fir cmd
docker run -v $HOME/fir-cli/data:/fir-cli flowci/fir-cli fir ${cmds[@]}
# clean folder
for i in ${tmpFiles}; do
if [ -d $i ];then
rm -rf $i
elif [ -f $i ];then
rm $i
fi
done