-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_release.sh
executable file
·49 lines (39 loc) · 2.14 KB
/
make_release.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
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd ${SCRIPT_DIR}
. ./toolchain.env
printf "Making release of rclone for ArangoDB with $GO_VERSION...\n\n"
RELEASE_TAG="${GO_VERSION//:/-}-$(git rev-parse --short HEAD)"
RELEASE_OUTPUT=${SCRIPT_DIR}/${RELEASE_TAG}
rm -rf ${RELEASE_OUTPUT} && mkdir -p ${RELEASE_OUTPUT}
for ARANGODB in $(echo 3.*)
do
cd ${SCRIPT_DIR}/${ARANGODB}
. ./rclone.env
printf "Making release of rclone for ArangoDB $ARANGODB...\n\n"
. ./targets.env
rm -rf ./rclone && \
git clone --single-branch --depth 1 -b ${RCLONE_VERSION} https://github.com/rclone/rclone.git && cd ./rclone
for TARGET in ${TARGETS}
do
TARGET_OS="${TARGET%_*}"
TARGET_ARCH="${TARGET#*_}"
printf "Building rclone $RCLONE_VERSION for $TARGET_OS-$TARGET_ARCH...\n\n"continue
docker run --rm -v "$(pwd):/rclone" \
-v "${HOME}:/user" \
-e "GOPATH=/user/rclone_go/go" \
-e "GOCACHE=/user/rclone_go/cache" \
-e "RCLONE_OUTPUT=${RELEASE_TAG}_${ARANGODB}_${RCLONE_VERSION}" \
-e "TARGET_OS=$TARGET_OS" \
-e "TARGET_ARCH=$TARGET_ARCH" \
-u "${UID}:${GID}" \
-w /rclone ${GO_VERSION} \
bash +x -c 'cd /rclone; go mod vendor; go get -u github.com/cloudflare/circl; go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity; go get -u golang.org/x/crypto; go get -u github.com/golang-jwt/jwt; go get google.golang.org/api; go mod tidy; go mod vendor; function build { GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/rclone/rclone/fs.VersionSuffix= " -tags cmount -o /rclone/${RCLONE_OUTPUT}_rclone-arangodb-$(echo $1 | sed "s/darwin/macos/g")-$2$([[ $1 == "windows" ]] && echo ".exe"); }; go get -u golang.org/x/sys; build $TARGET_OS $TARGET_ARCH' && \
mv ./*rclone-arangodb-*-* "${RELEASE_OUTPUT}" && rm -rf ./*rclone-arangodb-*-*
printf "\n\nDone building rclone $RCLONE_VERSION for $TARGET_OS-$TARGET_ARCH!\n\n"
done
printf "\n\nDone making release of rclone for ArangoDB $ARANGODB!\n\n"
rm -rf ${SCRIPT_DIR}/${ARANGODB}/rclone
done
printf "\n\nDone making release of rclone for ArangoDB with $GO_VERSION!\n\n"