forked from jerson/react-native-fast-openpgp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
upgrade_lib_bridge.sh
executable file
·64 lines (49 loc) · 1.89 KB
/
upgrade_lib_bridge.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
#!/usr/bin/env bash
#######################################################
# Usage: #
# ./upgrade_bridge_libs.sh #
# #
# or custom version: #
# VERSION=v0.1.1 ./upgrade_bridge_libs.sh #
#######################################################
REPO="jerson/openpgp-mobile"
NAME="gomobile_openpgp"
FRAMEWORK="Openpgp"
PLATFORMS=("android_aar" "ios_framework")
OUTPUT_DIRS=("android/libs" "ios")
OUTPUT_SUB_DIRS=("" "")
#######################################################
# you shouldn't edit below this line #
#######################################################
echo "Get latest release"
RELEASE_PAYLOAD=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest")
get_version() {
echo "$RELEASE_PAYLOAD" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
LATEST_VERSION=$(get_version $REPO)
VERSION=${VERSION:-$LATEST_VERSION}
rm -rf ios/${FRAMEWORK}.framework.zip ios/${FRAMEWORK}.framework
echo "Using: $VERSION"
echo "--------------------------------------------"
INDEX=0
for PLATFORM in "${PLATFORMS[@]}"
do
:
OUTPUT_DIR=${OUTPUT_DIRS[$INDEX]}
OUTPUT_SUB_DIR=${OUTPUT_SUB_DIRS[$INDEX]}
OUTPUT_STRIP_DIR=${OUTPUT_STRIP_DIRS[$INDEX]}
echo "Platform: $PLATFORM"
FILE_URL="https://github.com/${REPO}/releases/download/${VERSION}/${NAME}_${PLATFORM}_${VERSION}.tar.gz"
echo "Downloading: $FILE_URL to $OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
wget -c "$FILE_URL" -O - | tar --strip-components=1 -xz -C "$OUTPUT_DIR" "$OUTPUT_SUB_DIR"
INDEX=${INDEX}+1
echo "Updated"
echo "--------------------------------------------"
done
#
echo "All updated"
echo "Compress framework"
cd ios && \
zip --symlinks -r ${FRAMEWORK}.framework.zip ${FRAMEWORK}.framework && \
rm -rf ${FRAMEWORK}.framework