1
1
mirror of https://github.com/casey/just.git synced 2024-11-23 11:04:09 +03:00
just/bin/package

51 lines
1001 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -euxo pipefail
version=${1#"refs/tags/"}
os=$2
target=$3
src=`pwd`
dist=$src/dist
bin=just
echo "Packaging $bin $version for $target..."
test -f Cargo.lock || cargo generate-lockfile
echo "Building $bin..."
RUSTFLAGS='--deny warnings --codegen target-feature=+crt-static' \
cargo build --bin $bin --target $target --release
executable=target/$target/release/$bin
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/$bin-$version-$target.tar.gz
tar czf $archive *
echo "::set-output name=archive::$archive"
;;
windows-2016)
archive=$dist/$bin-$version-$target.zip
7z a $archive *
echo "::set-output name=archive::`pwd -W`/$bin-$version-$target.zip"
;;
esac