2020-01-28 12:41:43 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
version=${1#"refs/tags/"}
|
|
|
|
os=$2
|
|
|
|
target=$3
|
|
|
|
src=`pwd`
|
|
|
|
dist=$src/dist
|
|
|
|
bin=imdl
|
|
|
|
|
|
|
|
echo "Packaging $bin $version for $target..."
|
|
|
|
|
|
|
|
test -f Cargo.lock || cargo generate-lockfile
|
|
|
|
|
|
|
|
echo "Building $bin..."
|
|
|
|
|
2020-04-21 09:45:28 +02:00
|
|
|
case $os in
|
|
|
|
ubuntu-latest)
|
|
|
|
sudo apt-get help2man install musl-tools
|
|
|
|
;;
|
|
|
|
macos-latest)
|
|
|
|
brew install help2man
|
|
|
|
;;
|
|
|
|
windows-latest)
|
|
|
|
choco install gnuwin
|
|
|
|
;;
|
|
|
|
esac
|
2020-03-18 23:28:40 +01:00
|
|
|
|
2020-01-28 12:41:43 +01:00
|
|
|
case $os in
|
|
|
|
ubuntu-latest | macos-latest)
|
|
|
|
cargo rustc --bin $bin --target $target --release -- -C lto
|
|
|
|
executable=target/$target/release/$bin
|
|
|
|
;;
|
|
|
|
windows-latest)
|
|
|
|
cargo rustc --bin $bin --target $target --release -- -C lto -C target-feature="+crt-static"
|
|
|
|
executable=target/$target/release/$bin.exe
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-04-21 09:27:07 +02:00
|
|
|
echo "Building completions..."
|
|
|
|
rm -rf completions
|
|
|
|
mkdir completions
|
|
|
|
$executable completions --dir completions
|
|
|
|
|
2020-04-21 09:45:28 +02:00
|
|
|
echo "Building man pages..."
|
|
|
|
rm -rf man
|
|
|
|
mkdir man
|
|
|
|
cargo run --package gen man
|
|
|
|
|
2020-01-28 12:41:43 +01:00
|
|
|
echo "Copying release files..."
|
|
|
|
mkdir dist
|
2020-03-28 06:46:41 +01:00
|
|
|
cp -r \
|
2020-01-28 12:41:43 +01:00
|
|
|
$executable \
|
2020-03-18 17:35:39 +01:00
|
|
|
CHANGELOG.md \
|
2020-03-18 23:28:40 +01:00
|
|
|
CONTRIBUTING \
|
2020-03-28 06:46:41 +01:00
|
|
|
Cargo.lock \
|
|
|
|
Cargo.toml \
|
2020-01-28 12:41:43 +01:00
|
|
|
LICENSE \
|
|
|
|
README.md \
|
2020-03-28 06:46:41 +01:00
|
|
|
completions \
|
2020-03-28 07:13:36 +01:00
|
|
|
man \
|
2020-01-28 12:41:43 +01: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"
|
|
|
|
;;
|
|
|
|
windows-latest)
|
|
|
|
archive=$dist/$bin-$version-$target.zip
|
|
|
|
7z a $archive *
|
|
|
|
echo "::set-output name=archive::`pwd -W`/$bin-$version-$target.zip"
|
|
|
|
;;
|
|
|
|
esac
|