Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple bash script to build release binaries #6

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/scripts/target
.idea
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ If you ever wanted to know what's taking so much space in your restic
repo so that you can find all the caches and useless things you might be backing
up and delete them from the snapshots, then this is exactly for you.

### Quick Start
1. Install with cargo
# Installing

You can either grab a pre-built binary from Github, currently available for:
- Darwin (macos) arm64
- Linux arm64
- Linux amd64

or you can install with cargo:
```
cargo install redu
```
Note: it currently requires nightly to build.
2. Run

# Running

You can use all the regular restic environment variables, they will be passed
to all restic subprocesses redu spawns.
Expand Down
23 changes: 23 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.."

set -x -e -o pipefail

NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')

function build {
local target=$1
local target_output_name=$2
local output_name="$NAME-$VERSION-$target_output_name"
cross build --target "$target" --release
mkdir -p "$ROOT_DIR/scripts/target"
cp "$ROOT_DIR/target/$target/release/$NAME" "$ROOT_DIR/scripts/target/$output_name"
rm -f "$ROOT_DIR/scripts/target/$output_name.bz2"
bzip2 -9 "$ROOT_DIR/scripts/target/$output_name"
}

build aarch64-apple-darwin darwin-arm64
build aarch64-unknown-linux-musl linux-arm64
build x86_64-unknown-linux-musl linux-amd64