...
1#!/usr/bin/env bash
2
3output_script_path="$1"
4v1_linux_tarball="$2"
5v1_darwin_tarball="$3"
6remotecli_linux_tarball="$4"
7remotecli_darwin_tarball="$5"
8bucket="${BINARY_RELEASE_BUCKET:-"edge-bin"}"
9
10while read -u 10 p ; do
11 key=$(echo $p | cut -d ' ' -f1)
12 value=$(echo $p | cut -d ' ' -f2)
13 command="export $key=$value"
14 eval $command
15done 10<bazel-out/stable-status.txt
16
17short_sha="$(echo $STABLE_APP_GIT_COMMIT | cut -c1-7)"
18semver="$(echo $STABLE_APP_SEMVER)"
19echo $STABLE_APP_GIT_COMMIT
20echo $semver
21echo "#!/usr/bin/env bash" > $output_script_path
22echo "set -x" >> $output_script_path
23echo >> $output_script_path
24
25function push_tarballs {
26 name="$1"
27 os="$2"
28 path="$3"
29
30 remote_path="gs://${bucket}/${name}-latest-${os}-amd64.tar.gz"
31 echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path
32 command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path"
33 echo $command >> $output_script_path
34
35 remote_path="gs://${bucket}/${name}-${semver}-${os}-amd64.tar.gz"
36 echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path
37 command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path"
38 echo $command >> $output_script_path
39
40 remote_path="gs://${bucket}/${name}-${short_sha}-${os}-amd64.tar.gz"
41 echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path
42 command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path"
43 echo $command >> $output_script_path
44
45 echo >> $output_script_path
46}
47
48push_tarballs "remotecliv1" "linux" "${v1_linux_tarball}"
49push_tarballs "remotecliv1" "darwin" "${v1_darwin_tarball}"
50push_tarballs "remotecli" "linux" "${remotecli_linux_tarball}"
51push_tarballs "remotecli" "darwin" "${remotecli_darwin_tarball}"
View as plain text