just/bin/package
2021-11-21 16:55:21 -08:00

48 lines
996 B
Bash
Executable File

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