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

57 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
set -euxo pipefail
2021-11-22 03:55:21 +03:00
VERSION=${REF#"refs/tags/"}
2021-12-05 13:51:15 +03:00
DIST=`pwd`/dist
2021-11-22 03:55:21 +03:00
echo "Packaging just $VERSION for $TARGET..."
test -f Cargo.lock || cargo generate-lockfile
echo "Installing rust toolchain for $TARGET..."
rustup target add $TARGET
if [[ $TARGET == aarch64-unknown-linux-musl ]]; then
export CC=aarch64-linux-gnu-gcc
fi
2021-11-22 03:55:21 +03:00
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-latest ]]; then
2021-11-22 03:55:21 +03:00
EXECUTABLE=$EXECUTABLE.exe
fi
echo "Copying release files..."
mkdir dist
cp -r \
2021-11-22 03:55:21 +03:00
$EXECUTABLE \
Cargo.lock \
Cargo.toml \
GRAMMAR.md \
LICENSE \
README.md \
completions \
man/just.1 \
2021-11-22 03:55:21 +03:00
$DIST
2021-11-22 03:55:21 +03:00
cd $DIST
echo "Creating release archive..."
2021-11-22 03:55:21 +03:00
case $OS in
ubuntu-latest | macos-latest)
ARCHIVE=just-$VERSION-$TARGET.tar.gz
2021-11-22 03:55:21 +03:00
tar czf $ARCHIVE *
shasum -a 256 $ARCHIVE > $ARCHIVE.sha256sum
echo "archive=$DIST/$ARCHIVE" >> $GITHUB_OUTPUT
;;
windows-latest)
ARCHIVE=just-$VERSION-$TARGET.zip
2021-11-22 03:55:21 +03:00
7z a $ARCHIVE *
sha256sum $ARCHIVE > $ARCHIVE.sha256sum
echo "archive=`pwd -W`/$ARCHIVE" >> $GITHUB_OUTPUT
;;
esac