Skip to content

Commit 9dc55e9

Browse files
authored
Add install.sh for easy installation and recommend in README.md (#384)
This PR introduces a widely known type of installation script for builder-playground and rearranges the README.md for clarity.
1 parent 399b5af commit 9dc55e9

File tree

2 files changed

+79
-13
lines changed

2 files changed

+79
-13
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,41 @@ Recipes (e.g. `l1`, `opstack`) assemble opinionated components and pre-baked con
1212
- Running repeatable CI and e2e scenarios
1313
- Experimenting with fork configurations and client combinations
1414

15-
Quick start:
15+
## Installation
16+
17+
### Install with script (recommended)
18+
19+
On Linux and macOS, you can install the latest version to `/usr/local/bin` with:
1620

1721
```bash
18-
# L1 environment with mev-boost relay
19-
builder-playground start l1
22+
curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/install.sh | bash
23+
```
2024

21-
# L2 OpStack with external builder support
22-
builder-playground start opstack --external-builder http://localhost:4444
25+
If you need to install a specific version, you can use the `VERSION` env var in the beginning like:
26+
```bash
27+
VERSION=1.2.3 curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/install.sh | bash
2328
```
2429

25-
## Installation
30+
### Install from repository
2631

27-
```
28-
$ go install github.com/flashbots/builder-playground@latest
32+
Extend the `PATH` variable with `GOPATH/bin` (or `GOBIN` if set), then clone the repository and do:
33+
```bash
34+
go install .
2935
```
3036

31-
or clone the repository and do:
37+
---
3238

33-
```
34-
$ go install .
35-
```
39+
These commands install to different directories as mentioned above so make sure to verify with `which $(builder-playground)` to avoid confusion!
3640

37-
or do `go build .` and run from the repository like `./builder-playground`.
41+
## Quick Examples
42+
43+
```bash
44+
# L1 environment with mev-boost relay
45+
builder-playground start l1
46+
47+
# L2 OpStack with external builder support
48+
builder-playground start opstack --external-builder http://localhost:4444
49+
```
3850

3951
## CI / GitHub Actions
4052

install.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO="flashbots/builder-playground"
5+
BIN="builder-playground"
6+
API="https://api.github.com/repos/${REPO}/releases/latest"
7+
8+
# Detect OS
9+
OS="$(uname | tr '[:upper:]' '[:lower:]')"
10+
case "$OS" in
11+
linux|darwin) ;;
12+
*) echo "Unsupported OS: $OS"; exit 1 ;;
13+
esac
14+
15+
# Detect ARCH
16+
ARCH="$(uname -m)"
17+
case "$ARCH" in
18+
x86_64) ARCH="amd64" ;;
19+
arm64|aarch64) ARCH="arm64" ;;
20+
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
21+
esac
22+
23+
if [ -n "${VERSION:-}" ]; then
24+
# Normalize: ensure tag has a "v" prefix
25+
TAG="${VERSION#v}"
26+
TAG="v${TAG}"
27+
echo "Checking version: $TAG"
28+
if ! curl -sSfL "https://api.github.com/repos/${REPO}/releases/tags/${TAG}" > /dev/null 2>&1; then
29+
echo "Error: version '${TAG}' not found. Check available releases at https://github.com/${REPO}/releases"
30+
exit 1
31+
fi
32+
else
33+
echo "Fetching latest release..."
34+
TAG=$(curl -sSfL "$API" | grep -oP '"tag_name": "\K(.*)(?=")')
35+
echo "Latest version: $TAG"
36+
fi
37+
38+
ASSET="${BIN}_${TAG}_${OS}_${ARCH}.zip"
39+
URL="https://github.com/${REPO}/releases/download/${TAG}/${ASSET}"
40+
41+
echo "Downloading $ASSET..."
42+
curl -sSfL "$URL" -o "$ASSET"
43+
44+
echo "Extracting..."
45+
unzip -o "$ASSET"
46+
47+
echo "Installing to /usr/local/bin..."
48+
chmod +x "$BIN"
49+
sudo mv "$BIN" /usr/local/bin/
50+
51+
echo "Cleaning up..."
52+
rm -f "$ASSET"
53+
54+
echo "✅ Installed $BIN $TAG for ${OS}-${ARCH}"

0 commit comments

Comments
 (0)