refactor(just): DRY up justfile

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2023-09-15 09:42:13 +02:00
parent 1fd416d717
commit be91b68b5a
No known key found for this signature in database
GPG key ID: 26C542FD97F965CE

View file

@ -109,53 +109,46 @@ all-release: build-release test-release
sleep 10
gh pr create --draft --title "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk
tar BINARY TARGET:
tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
zip BINARY TARGET:
zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}}
binary BINARY TARGET:
rustup target add {{TARGET}}
cross build --release --target {{TARGET}}
just tar {{BINARY}} {{TARGET}}
just zip {{BINARY}} {{TARGET}}
alias c := cross
# If you're not cafkafk and she isn't dead, you probably don't need to run
# this!
#
# usage: cross
@cross:
# Setup Output Directory
mkdir -p ./target/"bin-$(convco version)"
# Install Toolchains/Targets
rustup toolchain install stable
## Linux
### x86
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-musl
just binary eza x86_64-unknown-linux-gnu
just binary eza x86_64-unknown-linux-musl
### aarch
rustup target add aarch64-unknown-linux-gnu
just binary eza aarch64-unknown-linux-gnu
### arm
rustup target add arm-unknown-linux-gnueabihf
just binary eza arm-unknown-linux-gnueabihf
## Windows
### x86
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-msvc
# Setup Output Directory
mkdir -p ./target/"bin-$(convco version)"
# Build
## Linux
### x86
cross build --target x86_64-unknown-linux-gnu --release
tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-gnu.tar.gz -C ./target/x86_64-unknown-linux-gnu/release/ ./eza
cross build --release --target=x86_64-unknown-linux-musl
tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-musl.tar.gz -C ./target/x86_64-unknown-linux-musl/release/ ./eza
cross build --target aarch64-unknown-linux-gnu --release
tar czvf ./target/"bin-$(convco version)"/eza_aarch64-unknown-linux-gnu.tar.gz -C ./target/aarch64-unknown-linux-gnu/release/ ./eza
cross build --target arm-unknown-linux-gnueabihf --release
tar czvf ./target/"bin-$(convco version)"/arm-unknown-linux-gnueabihf.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release/ ./eza
## Windows
cross build --target x86_64-pc-windows-gnu --release
zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-gnu.zip ./target/x86_64-pc-windows-gnu/release/eza.exe
cross build --target x86_64-pc-windows-msvc --release
zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-msvc.zip ./target/x86_64-pc-windows-gnu/release/eza.exe
just binary eza.exe x86_64-pc-windows-gnu
just binary eza.exe x86_64-pc-windows-msvc
# Generate Checksums
echo "# Checksums"