Skip to content

Commit 72d0536

Browse files
committed
Replace Gitea bin download with GitHub Releases
1 parent e985b8a commit 72d0536

3 files changed

Lines changed: 99 additions & 99 deletions

File tree

scripts/android/download.sh

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
#!/bin/bash
22

3+
set -e
4+
35
LIB_ROOT=../..
4-
OS=android
5-
ANDROID_LIBS_DIR=$LIB_ROOT/android/src/main/jniLibs
6-
7-
TAG_COMMIT=$(git log -1 --pretty=format:"%H")
8-
9-
rm -rf flutter_libepiccash_bins
10-
git clone https://git.cypherstack.com/stackwallet/flutter_libepiccash_bins
11-
if [ -d flutter_libepiccash_bins ]; then
12-
cd flutter_libepiccash_bins
13-
else
14-
echo "Failed to clone flutter_libepiccash_bins"
15-
exit 1
16-
fi
17-
18-
BIN=libepic_cash_wallet.so
19-
20-
for TARGET in arm64-v8a armeabi-v7a x86_64
21-
do
22-
ARCH_PATH=$TARGET
23-
if [ ! $(git tag -l "${OS}_${TARGET}_${TAG_COMMIT}") ]; then
24-
echo "No precompiled bins for $TAG_COMMIT found, using latest for $OS/$TARGET!"
25-
fi
26-
git checkout "${OS}_${TARGET}_${TAG_COMMIT}" || git checkout $OS/$TARGET
27-
if [ -f "$OS/$ARCH_PATH/$BIN" ]; then
28-
mkdir -p ../$ANDROID_LIBS_DIR/$ARCH_PATH
29-
# TODO verify bin checksum hashes
30-
cp -rf "$OS/$ARCH_PATH/$BIN" "../$ANDROID_LIBS_DIR/$ARCH_PATH/$BIN"
31-
else
32-
echo "$TARGET not found at $OS/$ARCH_PATH/$BIN!"
33-
fi
34-
done
6+
REPO="cypherstack/flutter_libepiccash"
7+
BASE_URL="https://github.com/${REPO}/releases/download"
8+
9+
TAG=$(git -C "$LIB_ROOT" describe --tags --exact-match HEAD 2>/dev/null) || {
10+
echo "Error: flutter_libepiccash is not at a tagged commit."
11+
echo "Pin the submodule to a release tag to use download mode."
12+
echo "Current commit: $(git -C "$LIB_ROOT" rev-parse HEAD)"
13+
exit 1
14+
}
15+
16+
TMPDIR=$(mktemp -d)
17+
trap 'rm -rf "$TMPDIR"' EXIT
18+
19+
curl -fSL "${BASE_URL}/${TAG}/checksums.txt" -o "$TMPDIR/checksums.txt"
20+
21+
download_and_verify() {
22+
local asset="$1"
23+
curl -fSL "${BASE_URL}/${TAG}/${asset}" -o "$TMPDIR/${asset}"
24+
grep "^[0-9a-f]* ${asset}$" "$TMPDIR/checksums.txt" | (cd "$TMPDIR" && sha256sum -c)
25+
}
26+
27+
JNILIBS="$LIB_ROOT/android/src/main/jniLibs"
28+
29+
download_and_verify "libepic_cash_wallet-android-arm64-v8a.so"
30+
mkdir -p "$JNILIBS/arm64-v8a"
31+
cp "$TMPDIR/libepic_cash_wallet-android-arm64-v8a.so" \
32+
"$JNILIBS/arm64-v8a/libepic_cash_wallet.so"
33+
34+
download_and_verify "libepic_cash_wallet-android-armeabi-v7a.so"
35+
mkdir -p "$JNILIBS/armeabi-v7a"
36+
cp "$TMPDIR/libepic_cash_wallet-android-armeabi-v7a.so" \
37+
"$JNILIBS/armeabi-v7a/libepic_cash_wallet.so"
38+
39+
download_and_verify "libepic_cash_wallet-android-x86_64.so"
40+
mkdir -p "$JNILIBS/x86_64"
41+
cp "$TMPDIR/libepic_cash_wallet-android-x86_64.so" \
42+
"$JNILIBS/x86_64/libepic_cash_wallet.so"

scripts/ios/download.sh

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
11
#!/bin/bash
22

3-
# IOS publish script WIP; doublecheck that they follow patterns in linux/android scripts before running
3+
set -e
44

55
LIB_ROOT=../..
6-
OS=ios
7-
IOS_LIBS_DIR=$LIB_ROOT/$OS/libs
8-
IOS_INCL_DIR=$LIB_ROOT/$OS/include
9-
10-
TAG_COMMIT=$(git log -1 --pretty=format:"%H")
11-
12-
rm -rf flutter_libepiccash_bins
13-
git clone https://git.cypherstack.com/stackwallet/flutter_libepiccash_bins
14-
if [ -d flutter_libepiccash_bins ]; then
15-
cd flutter_libepiccash_bins
16-
else
17-
echo "Failed to clone flutter_libepiccash_bins"
18-
exit 1
19-
fi
20-
21-
HEADER=libepic_cash_wallet.h
22-
BIN=libepic_cash_wallet.a
23-
24-
for TARGET in aarch64-apple-ios
25-
do
26-
ARCH_PATH=$TARGET/release
27-
if [ $(git tag -l $TARGET"_$TAG_COMMIT") ]; then
28-
git checkout $TARGET"_$TAG_COMMIT"
29-
if [ -f "$OS/$ARCH_PATH/$BIN" ]; then
30-
mkdir -p ../$IOS_LIBS_DIR
31-
mkdir -p ../$IOS_INCL_DIR
32-
# TODO verify bin checksum hashes
33-
cp -rf "$OS/$ARCH_PATH/$BIN" "../$IOS_LIBS_DIR/$BIN"
34-
cp -rf "$OS/$ARCH_PATH/$HEADER" "../$IOS_INCL_DIR/$HEADER"
35-
else
36-
echo "$TARGET not found!"
37-
fi
38-
else
39-
echo "No precompiled bins for $TARGET found!"
40-
fi
41-
done
6+
REPO="cypherstack/flutter_libepiccash"
7+
BASE_URL="https://github.com/${REPO}/releases/download"
8+
9+
TAG=$(git -C "$LIB_ROOT" describe --tags --exact-match HEAD 2>/dev/null) || {
10+
echo "Error: flutter_libepiccash is not at a tagged commit."
11+
echo "Pin the submodule to a release tag to use download mode."
12+
echo "Current commit: $(git -C "$LIB_ROOT" rev-parse HEAD)"
13+
exit 1
14+
}
15+
16+
TMPDIR=$(mktemp -d)
17+
trap 'rm -rf "$TMPDIR"' EXIT
18+
19+
curl -fSL "${BASE_URL}/${TAG}/checksums.txt" -o "$TMPDIR/checksums.txt"
20+
21+
download_and_verify() {
22+
local asset="$1"
23+
curl -fSL "${BASE_URL}/${TAG}/${asset}" -o "$TMPDIR/${asset}"
24+
grep "^[0-9a-f]* ${asset}$" "$TMPDIR/checksums.txt" | (cd "$TMPDIR" && sha256sum -c)
25+
}
26+
27+
download_and_verify "libepic_cash_wallet-ios-aarch64.a"
28+
download_and_verify "libepic_cash_wallet.h"
29+
30+
mkdir -p "$LIB_ROOT/ios/libs" "$LIB_ROOT/ios/include"
31+
cp "$TMPDIR/libepic_cash_wallet-ios-aarch64.a" "$LIB_ROOT/ios/libs/libepic_cash_wallet.a"
32+
cp "$TMPDIR/libepic_cash_wallet.h" "$LIB_ROOT/ios/include/libepic_cash_wallet.h"

scripts/linux/download.sh

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
#!/bin/bash
22

3+
set -e
4+
35
LIB_ROOT=../..
4-
OS=linux
5-
LINUX_LIBS_DIR=$LIB_ROOT/$OS/bin
6-
7-
TAG_COMMIT=$(git log -1 --pretty=format:"%H")
8-
9-
rm -rf flutter_libepiccash_bins
10-
git clone https://git.cypherstack.com/stackwallet/flutter_libepiccash_bins
11-
if [ -d flutter_libepiccash_bins ]; then
12-
cd flutter_libepiccash_bins
13-
else
14-
echo "Failed to clone flutter_libepiccash_bins"
15-
exit 1
16-
fi
17-
18-
BIN=libepic_cash_wallet.so
19-
20-
for TARGET in aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu
21-
do
22-
ARCH_PATH=$TARGET/release
23-
if [ ! $(git tag -l "${OS}_${TARGET}_${TAG_COMMIT}") ]; then
24-
echo "No precompiled bins for $TAG_COMMIT found, using latest for $OS/$TARGET!"
25-
fi
26-
git checkout "${OS}_${TARGET}_${TAG_COMMIT}" || git checkout $OS/$TARGET
27-
if [ -f "$OS/$ARCH_PATH/$BIN" ]; then
28-
mkdir -p ../$LINUX_LIBS_DIR/$ARCH_PATH
29-
# TODO verify bin checksum hashes
30-
cp -rf "$OS/$ARCH_PATH/$BIN" "../$LINUX_LIBS_DIR/$ARCH_PATH/$BIN"
31-
else
32-
echo "$TARGET not found at $OS/$ARCH_PATH/$BIN!"
33-
fi
34-
done
6+
REPO="cypherstack/flutter_libepiccash"
7+
BASE_URL="https://github.com/${REPO}/releases/download"
8+
9+
TAG=$(git -C "$LIB_ROOT" describe --tags --exact-match HEAD 2>/dev/null) || {
10+
echo "Error: flutter_libepiccash is not at a tagged commit."
11+
echo "Pin the submodule to a release tag to use download mode."
12+
echo "Current commit: $(git -C "$LIB_ROOT" rev-parse HEAD)"
13+
exit 1
14+
}
15+
16+
TMPDIR=$(mktemp -d)
17+
trap 'rm -rf "$TMPDIR"' EXIT
18+
19+
curl -fSL "${BASE_URL}/${TAG}/checksums.txt" -o "$TMPDIR/checksums.txt"
20+
21+
download_and_verify() {
22+
local asset="$1"
23+
curl -fSL "${BASE_URL}/${TAG}/${asset}" -o "$TMPDIR/${asset}"
24+
grep "^[0-9a-f]* ${asset}$" "$TMPDIR/checksums.txt" | (cd "$TMPDIR" && sha256sum -c)
25+
}
26+
27+
download_and_verify "libepic_cash_wallet-linux-x86_64.so"
28+
mkdir -p "$LIB_ROOT/linux/bin/x86_64-unknown-linux-gnu/release"
29+
cp "$TMPDIR/libepic_cash_wallet-linux-x86_64.so" \
30+
"$LIB_ROOT/linux/bin/x86_64-unknown-linux-gnu/release/libepic_cash_wallet.so"
31+
32+
download_and_verify "libepic_cash_wallet-linux-aarch64.so"
33+
mkdir -p "$LIB_ROOT/linux/bin/aarch64-unknown-linux-gnu/release"
34+
cp "$TMPDIR/libepic_cash_wallet-linux-aarch64.so" \
35+
"$LIB_ROOT/linux/bin/aarch64-unknown-linux-gnu/release/libepic_cash_wallet.so"

0 commit comments

Comments
 (0)