-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbosSync.sh
45 lines (37 loc) · 1.13 KB
/
bosSync.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
#!/usr/bin/env bash
set -e
ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
repos=$1
version=$2
echo "Sleep for 5 seconds"
sleep 5s
mkdir -p $ROOT/temp
remote="https://codeload.github.com/fis-components/${repos}/tar.gz/${version}"
filename="temp/${repos}_${version}.tar.gz"
echo "Downloading ${remote}"
echo "curl -o ${ROOT}/${filename} $remote"
curl -o ${ROOT}/${filename} $remote
if [ "$?" != "0" ]; then
exit 1
fi
info="https://raw.githubusercontent.com/fis-components/${repos}/${version}/component.json"
infofile="temp/${repos}_${version}.json"
echo "Downloading ${info}"
echo "curl -o ${ROOT}/${infofile} $info"
curl -o ${ROOT}/${infofile} $info
if [ "$?" != "0" ]; then
exit 1
fi
echo "cat ${ROOT}/${infofile}"
cat ${ROOT}/${infofile}
ak="${BOS_AK}"
sk="${BOS_SK}"
versions=$(git ls-remote --tags --refs --heads https://github.com/fis-components/${repos}.git | awk -F/ '{print $3}')
versionsfile="temp/${repos}_versions.txt"
echo $versions > ${ROOT}/${versionsfile}
cat ${ROOT}/${versionsfile}
#php -v
php $ROOT/bos/sync.php "${ak}" "${sk}" $repos $version $filename $infofile $versionsfile
if [ "$?" != "0" ]; then
exit 1
fi