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

55 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euxo pipefail
VERSION=${REF#"refs/tags/"}
DIST=`pwd`/dist
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
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
EXECUTABLE=$EXECUTABLE.exe
fi
echo "Copying release files..."
mkdir dist
cp -r \
$EXECUTABLE \
Cargo.lock \
Cargo.toml \
GRAMMAR.md \
LICENSE \
README.md \
completions \
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 "archive=$ARCHIVE" >> $GITHUB_OUTPUT
;;
windows-latest)
ARCHIVE=$DIST/just-$VERSION-$TARGET.zip
7z a $ARCHIVE *
echo "archive=`pwd -W`/just-$VERSION-$TARGET.zip" >> $GITHUB_OUTPUT
;;
esac