#!/bin/bash # package the build artifacts # heavily inspired by https://github.com/BurntSushi/ripgrep/blob/master/ci/before_deploy.sh set -ex . "$(dirname $0)/utils.sh" # Generate artifacts for release mk_artifacts() { cargo build --target "$TARGET" --release } mk_tarball() { # Create a temporary dir that contains our staging area. # $tmpdir/$name is what eventually ends up as the deployed archive. local tmpdir="$(mktemp -d)" local name="${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}" local staging="$tmpdir/$name" mkdir "$staging" # The deployment directory is where the final archive will reside. # This path is known by the .travis.yml configuration. local out_dir="$(pwd)/deployment" mkdir -p "$out_dir" cp "target/$TARGET/release/ttv" "$staging/ttv" strip "$staging/ttv" (cd "$tmpdir" && tar czf "$out_dir/$name.tar.gz" "$name") rm -rf "$tmpdir" } main() { mk_artifacts mk_tarball } main