2020-01-28 02:19:24 -08:00
|
|
|
#!/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..."
|
2021-10-11 17:16:30 -07:00
|
|
|
cargo build --bin $bin --target $target --release
|
|
|
|
executable=target/$target/release/$bin
|
2020-01-28 02:19:24 -08:00
|
|
|
|
2021-10-11 17:16:30 -07:00
|
|
|
if [[ $os == windows-2016 ]]; then
|
|
|
|
executable=$executable.exe
|
|
|
|
fi
|
2020-01-28 02:19:24 -08:00
|
|
|
|
|
|
|
echo "Copying release files..."
|
|
|
|
mkdir dist
|
2020-01-28 02:55:30 -08:00
|
|
|
cp \
|
2020-01-28 02:19:24 -08:00
|
|
|
$executable \
|
|
|
|
Cargo.lock \
|
|
|
|
Cargo.toml \
|
|
|
|
GRAMMAR.md \
|
|
|
|
LICENSE \
|
|
|
|
README.adoc \
|
2020-01-28 02:55:30 -08:00
|
|
|
man/just.1 \
|
2020-01-28 02:19:24 -08:00
|
|
|
$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"
|
|
|
|
;;
|
2020-08-05 19:20:11 -07:00
|
|
|
windows-2016)
|
2020-01-28 02:19:24 -08:00
|
|
|
archive=$dist/$bin-$version-$target.zip
|
|
|
|
7z a $archive *
|
|
|
|
echo "::set-output name=archive::`pwd -W`/$bin-$version-$target.zip"
|
|
|
|
;;
|
|
|
|
esac
|