#!/bin/bash set -euo pipefail script_dir="$(cd $(dirname $BASH_SOURCE[0]); echo $PWD)" root_dir="$(cd $script_dir/../..; echo $PWD)" source $script_dir/functions.sh cd $root_dir cargo build --release SECRETGARDEN=$root_dir/target/release/secretgarden secretgarden_version="$( cargo metadata --manifest-path $root_dir/Cargo.toml --format-version 1 | \ jq -r '.packages[] | select(.name == "secretgarden") | .version' )" if [[ -z $secretgarden_version ]]; then echo "Failed to determine secretgarden version" >&2 exit 1 fi version_assets_directory="$script_dir/assets/versions" cd "$(mktemp -d)" mkdir -p $secretgarden_version/outputs pushd $secretgarden_version spawn_ssh_agent trap _kill_ssh_agents EXIT ssh-keygen -t ed25519 -N '' -C "secretgarden_assets_$secretgarden_version" -f $PWD/id > /dev/null ssh-add $PWD/id > /dev/null function store_output { $SECRETGARDEN "$@" > outputs/"$*" } function store_ssh_key_output { store_output "$@" store_output "$@" --public } cat > secretgarden.toml <