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