Skip to content

Commit 3aa2faf

Browse files
feat(cli): Publish binary and install.sh to GitHub Pages.
1 parent 59ceb6f commit 3aa2faf

4 files changed

Lines changed: 94 additions & 4 deletions

File tree

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cli (parallel) ────────┘
99
| Workflow | Role |
1010
|----------|------|
1111
| `_check.yml` | `cargo shear` + `clippy` (host and wasm targets) |
12-
| `_cli.yml` | Builds and tests the `cli/` workspace (`cargo build` + `cargo test`); engine-tagged cases stay off, no Chromium needed |
12+
| `_cli.yml` | Builds and tests the `cli/` workspace (`cargo build` + `cargo test`); on `main` pushes also publishes the release binary + `install.sh` to GitHub Pages |
1313
| `_wasm.yml` | Builds and optimizes `compiler_lib.wasm`. On tags, attaches the `.wasm` to the GitHub Release |
1414
| `_runtime_check.yml` | JS-side gate: `deno lint runtime/` + `deno test runtime/tests/` (Playwright + Chromium driving `createWorker` against the CDN-deployed wasm). Independent branch, runs in parallel with the Rust pipeline; only the CDN upload below blocks on it |
1515
| `_runtime.yml` | Bundles `runtime/` + `compiler_lib.wasm` and deploys them to Cloudflare Pages |

.github/workflows/_cli.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,44 @@ jobs:
2727
- name: Test
2828
working-directory: cli
2929
run: cargo test
30+
31+
pages:
32+
name: Publish to GitHub Pages
33+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
34+
needs: build_test
35+
runs-on: ubuntu-latest
36+
permissions:
37+
pages: write
38+
id-token: write
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deploy.outputs.page_url }}
42+
43+
steps:
44+
- uses: actions/checkout@v6
45+
46+
- uses: dtolnay/rust-toolchain@stable
47+
48+
- name: Cache Rust
49+
uses: Swatinem/rust-cache@v2
50+
with:
51+
workspaces: cli -> cli/target
52+
53+
- name: Build release binary
54+
working-directory: cli
55+
run: cargo build --release
56+
57+
# Stage everything the install.sh expects under the site root.
58+
- name: Stage Pages site
59+
working-directory: cli
60+
run: |
61+
mkdir -p _site
62+
tar -C target/release -czf _site/edge-x86_64-unknown-linux-gnu.tar.gz edge
63+
cp install.sh _site/install.sh
64+
65+
- uses: actions/upload-pages-artifact@v3
66+
with:
67+
path: cli/_site
68+
69+
- id: deploy
70+
uses: actions/deploy-pages@v4

cli/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ edge build # bundle to dist/
1717
## Install
1818

1919
```bash
20-
# Prebuilt binary (recommended)
21-
curl -fsSL https://edgepython.com/install.sh | sh
20+
# Prebuilt binary (Linux x86_64; recommended)
21+
curl -fsSL https://dylan-sutton-chavez.github.io/edge-python/install.sh | sh
2222

23-
# Or from source
23+
# Or from source (any platform with a Rust toolchain)
2424
cargo install --path cli
2525
```
2626

27+
`install.sh` drops the binary at `~/.local/bin/edge` and appends that directory to your `~/.bashrc` or `~/.zshrc` if it is not already on `PATH`. Open a new shell (or `source` the file it printed) and `edge --version` should work. Re-run the same `curl … | sh` line any time to upgrade.
28+
2729
The first command that needs a browser downloads a known-good Chromium into the cache automatically. Non-x86_64 platforms (aarch64, ARM, Apple Silicon) need a system Chrome or `EDGE_CHROME_PATH` set; see [Running on non-x86_64](#running-on-non-x86_64).
2830

2931
---

cli/install.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
# Re-run this script any time to upgrade.
3+
4+
set -e
5+
6+
BASE="${EDGE_INSTALL_BASE:-https://dylan-sutton-chavez.github.io/edge-python}"
7+
INSTALL_DIR="${EDGE_INSTALL_DIR:-$HOME/.local/bin}"
8+
9+
case "$(uname -s)" in
10+
Linux) os="unknown-linux-gnu" ;;
11+
Darwin) os="apple-darwin" ;;
12+
*) echo "unsupported OS: $(uname -s)" >&2; exit 1 ;;
13+
esac
14+
15+
case "$(uname -m)" in
16+
x86_64|amd64) arch="x86_64" ;;
17+
aarch64|arm64) arch="aarch64" ;;
18+
*) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;;
19+
esac
20+
21+
target="${arch}-${os}"
22+
23+
if [ "$target" != "x86_64-unknown-linux-gnu" ]; then
24+
echo "no prebuilt for $target yet; build from source with 'cargo install --path cli'" >&2
25+
exit 1
26+
fi
27+
28+
mkdir -p "$INSTALL_DIR"
29+
curl -fsSL "${BASE}/edge-${target}.tar.gz" | tar -xz -C "$INSTALL_DIR" edge
30+
chmod +x "$INSTALL_DIR/edge"
31+
32+
case ":$PATH:" in
33+
*":$INSTALL_DIR:"*) ;;
34+
*)
35+
case "$(basename "${SHELL:-bash}")" in
36+
bash) rc="$HOME/.bashrc" ;;
37+
zsh) rc="$HOME/.zshrc" ;;
38+
*) rc="" ;;
39+
esac
40+
if [ -n "$rc" ] && ! grep -qs "$INSTALL_DIR" "$rc" 2>/dev/null; then
41+
printf '\nexport PATH="%s:$PATH"\n' "$INSTALL_DIR" >> "$rc"
42+
echo "added $INSTALL_DIR to PATH in $rc; run 'source $rc' or open a new shell"
43+
fi
44+
;;
45+
esac
46+
47+
"$INSTALL_DIR/edge" --version

0 commit comments

Comments
 (0)