#!/usr/bin/env bash set -euxo pipefail VERSION=`basename $REF` DIST=`pwd`/dist BIN=present echo "Packaging $BIN $VERSION for $TARGET..." echo "Building $BIN..." RUSTFLAGS="$TARGET_RUSTFLAGS" cargo build --bin $BIN --target $TARGET --release EXECUTABLE=target/$TARGET/release/$BIN if [[ $OS == windows-latest ]]; then EXECUTABLE=$EXECUTABLE.exe fi echo "Copying release files..." mkdir $DIST cp \ $EXECUTABLE \ Cargo.lock \ Cargo.toml \ LICENSE \ README.md \ $DIST cd $DIST echo "Creating release archive..." case $OS in ubuntu-latest | macos-latest) ARCHIVE=$DIST/$BIN-$VERSION-$TARGET.tar.gz tar czf $ARCHIVE * echo "::set-output name=archive::$ARCHIVE" ;; windows-latest) ARCHIVE=$DIST/$BIN-$VERSION-$TARGET.zip 7z a $ARCHIVE * echo "::set-output name=archive::`pwd -W`/$BIN-$VERSION-$TARGET.zip" ;; esac