Skip to content

Commit 69dae35

Browse files
committed
release tooling: install.sh (curl|sh) + release workflow + README one-liner
- .github/workflows/release.yml: build avm + animus shim per-platform on v* tags, package both into avm-<target>.tar.gz + sha256, upload to the GitHub release. - install.sh: detect target, download the latest release, install avm into ~/.avm/bin + the animus shim into ~/.avm/shims, wire PATH (shim first). - README: feature the curl one-liner as the primary install method.
1 parent 1fdd042 commit 69dae35

3 files changed

Lines changed: 164 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: build ${{ matrix.target }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
cross: false
22+
- os: ubuntu-latest
23+
target: aarch64-unknown-linux-gnu
24+
cross: true
25+
- os: macos-latest
26+
target: x86_64-apple-darwin
27+
cross: false
28+
- os: macos-latest
29+
target: aarch64-apple-darwin
30+
cross: false
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: dtolnay/rust-toolchain@stable
34+
with:
35+
targets: ${{ matrix.target }}
36+
- uses: Swatinem/rust-cache@v2
37+
- name: install cross
38+
if: matrix.cross
39+
run: cargo install cross --git https://github.com/cross-rs/cross --locked
40+
- name: build (cross)
41+
if: matrix.cross
42+
run: cross build --release --target ${{ matrix.target }}
43+
- name: build (native)
44+
if: '!matrix.cross'
45+
run: cargo build --release --target ${{ matrix.target }}
46+
- name: package
47+
run: |
48+
set -euo pipefail
49+
mkdir -p dist
50+
# One tarball per target, holding BOTH the manager (`avm`) and the
51+
# transparent `animus` shim. The install script unpacks both.
52+
ARCHIVE="avm-${{ matrix.target }}.tar.gz"
53+
tar -C "target/${{ matrix.target }}/release" -czf "dist/${ARCHIVE}" avm animus
54+
( cd dist && shasum -a 256 "${ARCHIVE}" > "${ARCHIVE}.sha256" )
55+
- uses: softprops/action-gh-release@v2
56+
with:
57+
files: dist/*

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,35 @@ Two binaries ship from this repo:
2020

2121
## Install
2222

23-
Build and install both binaries with Cargo:
23+
**One-liner (recommended).** Downloads the `avm` manager + the `animus` shim,
24+
puts the shim first on your `PATH`, and is safe to re-run (upgrades in place):
2425

2526
```sh
26-
cargo install --path . # from a checkout
27-
# or, once published:
28-
cargo install --git https://github.com/launchapp-dev/avm
27+
curl -fsSL https://raw.githubusercontent.com/launchapp-dev/avm/main/install.sh | sh
2928
```
3029

31-
Then put the shim ahead of any other `animus` on your `PATH`. `cargo install` places
32-
both binaries in `~/.cargo/bin`. avm keeps a shims directory at `~/.avm/shims`; symlink
33-
the Cargo-installed `animus` shim into it and put that dir first on `PATH`:
30+
Then open a new shell and install a kernel:
3431

3532
```sh
33+
avm install v0.6.9 # download a kernel version
34+
avm use --global v0.6.9 # machine default
35+
animus --version # now resolved through avm
36+
```
37+
38+
The installer drops `avm` into `~/.avm/bin`, the `animus` shim into `~/.avm/shims`,
39+
and adds `export PATH="$HOME/.avm/shims:$HOME/.avm/bin:$PATH"` to your shell profile
40+
(ahead of any other `animus`). Env knobs: `AVM_VERSION` (pin the avm release),
41+
`AVM_HOME` (install root), `AVM_NO_PROFILE=1` (don't edit the profile).
42+
43+
**From source (Cargo).** Builds both binaries into `~/.cargo/bin`:
44+
45+
```sh
46+
cargo install --git https://github.com/launchapp-dev/avm # or: cargo install --path .
3647
mkdir -p ~/.avm/shims
3748
# link the Cargo-installed shim explicitly — do NOT use `command -v animus`,
3849
# which would resolve to the shim itself once ~/.avm/shims is on PATH.
3950
ln -sf "${CARGO_HOME:-$HOME/.cargo}/bin/animus" ~/.avm/shims/animus
40-
# add to your shell profile, BEFORE other animus locations:
41-
export PATH="$HOME/.avm/shims:$PATH"
51+
export PATH="$HOME/.avm/shims:$PATH" # add to your shell profile, before other animus
4252
```
4353

4454
`avm shim-dir` prints the directory to add to `PATH`.

install.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env sh
2+
# avm installer — downloads the avm manager + the `animus` shim and puts the
3+
# shim first on your PATH, so `animus` in any project uses that project's pinned
4+
# kernel version. Re-runnable (upgrades in place).
5+
#
6+
# curl -fsSL https://raw.githubusercontent.com/launchapp-dev/avm/main/install.sh | sh
7+
#
8+
# Honors:
9+
# AVM_VERSION release tag to install (default: latest)
10+
# AVM_HOME install root (default: ~/.avm)
11+
# AVM_NO_PROFILE=1 skip editing the shell profile (just print the PATH line)
12+
set -eu
13+
14+
REPO="launchapp-dev/avm"
15+
AVM_HOME="${AVM_HOME:-$HOME/.avm}"
16+
BIN_DIR="$AVM_HOME/bin"
17+
SHIM_DIR="$AVM_HOME/shims"
18+
19+
say() { printf '%s\n' "$*"; }
20+
err() { printf 'avm-install: %s\n' "$*" >&2; exit 1; }
21+
22+
# --- detect target triple -------------------------------------------------
23+
os="$(uname -s)"
24+
arch="$(uname -m)"
25+
case "$os" in
26+
Darwin) plat="apple-darwin" ;;
27+
Linux) plat="unknown-linux-gnu" ;;
28+
*) err "unsupported OS: $os" ;;
29+
esac
30+
case "$arch" in
31+
x86_64|amd64) cpu="x86_64" ;;
32+
arm64|aarch64) cpu="aarch64" ;;
33+
*) err "unsupported arch: $arch" ;;
34+
esac
35+
target="${cpu}-${plat}"
36+
37+
# --- resolve version ------------------------------------------------------
38+
version="${AVM_VERSION:-}"
39+
if [ -z "$version" ]; then
40+
version="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
41+
| sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)"
42+
[ -n "$version" ] || err "could not resolve the latest avm release; set AVM_VERSION=vX.Y.Z"
43+
fi
44+
45+
archive="avm-${target}.tar.gz"
46+
url="https://github.com/${REPO}/releases/download/${version}/${archive}"
47+
say "Installing avm ${version} (${target})…"
48+
49+
tmp="$(mktemp -d)"
50+
trap 'rm -rf "$tmp"' EXIT
51+
curl -fsSL -o "$tmp/$archive" "$url" || err "download failed: $url"
52+
# Verify checksum when the sidecar is present.
53+
if curl -fsSL -o "$tmp/$archive.sha256" "${url}.sha256" 2>/dev/null; then
54+
( cd "$tmp" && sed "s#\$# *${archive}#" "$archive.sha256" >/dev/null 2>&1 || true )
55+
if command -v shasum >/dev/null 2>&1; then
56+
want="$(awk '{print $1}' "$tmp/$archive.sha256")"
57+
got="$(shasum -a 256 "$tmp/$archive" | awk '{print $1}')"
58+
[ "$want" = "$got" ] || err "checksum mismatch for $archive (want $want, got $got)"
59+
fi
60+
fi
61+
62+
mkdir -p "$BIN_DIR" "$SHIM_DIR"
63+
tar -xzf "$tmp/$archive" -C "$tmp"
64+
install -m 0755 "$tmp/avm" "$BIN_DIR/avm"
65+
# The `animus` shim lives in the shims dir (first on PATH); `avm` lives in bin.
66+
install -m 0755 "$tmp/animus" "$SHIM_DIR/animus"
67+
say "Installed: $BIN_DIR/avm + $SHIM_DIR/animus"
68+
69+
# --- PATH wiring ----------------------------------------------------------
70+
path_line='export PATH="$HOME/.avm/shims:$HOME/.avm/bin:$PATH"'
71+
profile=""
72+
case "${SHELL:-}" in
73+
*/zsh) profile="$HOME/.zshrc" ;;
74+
*/bash) [ -f "$HOME/.bashrc" ] && profile="$HOME/.bashrc" || profile="$HOME/.bash_profile" ;;
75+
*) profile="$HOME/.profile" ;;
76+
esac
77+
if [ "${AVM_NO_PROFILE:-0}" != "1" ] && [ -n "$profile" ]; then
78+
if [ ! -f "$profile" ] || ! grep -q '.avm/shims' "$profile" 2>/dev/null; then
79+
printf '\n# avm — Animus Version Manager (shim first on PATH)\n%s\n' "$path_line" >> "$profile"
80+
say "Added avm to PATH in $profile"
81+
fi
82+
fi
83+
84+
say ""
85+
say "avm ${version} installed. Open a new shell (or run: ${path_line#export }) then:"
86+
say " avm install <version> # e.g. avm install v0.6.9"
87+
say " avm use --global <version> # machine default"
88+
say " avm use <version> # pin THIS project (writes ./.animus-version)"

0 commit comments

Comments
 (0)