#!/usr/bin/env bash output_script_path="$1" v1_linux_tarball="$2" v1_darwin_tarball="$3" remotecli_linux_tarball="$4" remotecli_darwin_tarball="$5" bucket="${BINARY_RELEASE_BUCKET:-"edge-bin"}" while read -u 10 p ; do key=$(echo $p | cut -d ' ' -f1) value=$(echo $p | cut -d ' ' -f2) command="export $key=$value" eval $command done 10 $output_script_path echo "set -x" >> $output_script_path echo >> $output_script_path function push_tarballs { name="$1" os="$2" path="$3" remote_path="gs://${bucket}/${name}-latest-${os}-amd64.tar.gz" echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path" echo $command >> $output_script_path remote_path="gs://${bucket}/${name}-${semver}-${os}-amd64.tar.gz" echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path" echo $command >> $output_script_path remote_path="gs://${bucket}/${name}-${short_sha}-${os}-amd64.tar.gz" echo "echo \"copying ${os} tarball to $remote_path\"" >> $output_script_path command="gsutil -m -o \"GSUtil:parallel_process_count=1\" cp -r ${path} $remote_path" echo $command >> $output_script_path echo >> $output_script_path } push_tarballs "remotecliv1" "linux" "${v1_linux_tarball}" push_tarballs "remotecliv1" "darwin" "${v1_darwin_tarball}" push_tarballs "remotecli" "linux" "${remotecli_linux_tarball}" push_tarballs "remotecli" "darwin" "${remotecli_darwin_tarball}"