blob: 4121daa0435ab06a0cae221555634a712f64523d [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Build the binary
cd "$SCRIPT_DIR/.." && cargo build --release
# Determine the os+arch
case "$(uname -s)" in
Linux*) OS=linux;;
Darwin*) OS=mac;;
*) echo "Unsupported OS"; exit 1
esac
case "$(uname -m)" in
x86_64*) ARCH=amd64;;
*) echo "Unsupported Arch"; exit 1
esac
# Get the git revision
GIT_REV="$(git describe --dirty --always --match="" --abbrev=0)"
# Generate a cipd.yaml
cat <<EOF > "$SCRIPT_DIR/../cipd.yaml"
# To upload the files in this CIPD package do:
#
# cipd create -pkg-def cipd.yaml -tag git_revision:$GIT_REV
#
# Optionally mark it as "latest"
#
# cipd set-ref fuchsia/third_party/fargo/$OS-$ARCH -ref latest -version [insert version from previous command's output]
#
package: fuchsia/third_party/fargo/$OS-$ARCH
root: target/release
data:
- file: fargo
EOF
cat "$SCRIPT_DIR/../cipd.yaml" | grep "#"