-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
71 lines (56 loc) · 1.44 KB
/
build.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# требования: zip, unzip, curl, jq, git, настроенный доступ ssh в гитхабе
KEY_GITHUB=$1
rm -rf tmpbuild
mkdir tmpbuild
cd tmpbuild
# запускаем счет файла
while read line;do
IFS=";"
set -- $line
# папка расширения
FOLDER=$1
# название репозитория
REPO=$2
# тип скачивания
TYPE=$3
# тип скачивания через git с указанием ветки
if [[ "${TYPE}" == "git" ]]
then
BRANCH=$4
if [[ "${BRANCH}" == "master" ]]
then
BRANCH=""
fi
if [[ "${BRANCH}" == "main" ]]
then
BRANCH=""
fi
git clone ${BRANCH} [email protected]:"${REPO}".git ${FOLDER}
cd "${FOLDER}"
rm -f README.md
rm -f .gitignore
rm -rf .git
cd ..
fi
if [[ "${TYPE}" == "release" ]]
then
FILE_NAME="${FOLDER}.zip"
API_URL="https://${KEY_GITHUB}:@api.github.com/repos/${REPO}"
ASSET_ID=$(curl "${API_URL}"/releases/latest | jq -r '.assets[0].id')
echo "Asset ID: $ASSET_ID"
rm -f "${FILE_NAME}"
curl -O -J -L -H "Accept: application/octet-stream" "$API_URL/releases/assets/$ASSET_ID"
unzip "${FOLDER}".zip -d "${FOLDER}"
rm -f "${FOLDER}".zip
fi
done < ../exts.txt
cd pkg_quantummanager
mv * ..
cd ..
rm -rf pkg_quantummanager
zip -r pkg_quantummanager.zip *
mv pkg_quantummanager.zip ..
cd ..
rm -rf tmpbuild
clear