Last active
February 22, 2026 06:21
-
-
Save antonl/c1b71abbd8f2b5c41a4796873617457c to your computer and use it in GitHub Desktop.
Dawn installer — one-line install from GitHub Releases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Dawn installer — downloads the latest release from GitHub using the gh CLI. | |
| # | |
| # Usage: | |
| # ./install.sh | |
| # | |
| # Options (environment variables): | |
| # DAWN_INSTALL_DIR Override install directory (default: ~/.local/bin) | |
| # VERSION Install a specific version (default: latest) | |
| # | |
| # Requirements: | |
| # - gh CLI (https://cli.github.com) installed and authenticated | |
| set -eu | |
| REPO="antonl/dawn" | |
| INSTALL_DIR="${DAWN_INSTALL_DIR:-$HOME/.local/bin}" | |
| # --- Check for gh CLI --- | |
| if ! command -v gh >/dev/null 2>&1; then | |
| echo "Error: gh CLI is required but not installed." >&2 | |
| echo "Install it from https://cli.github.com" >&2 | |
| exit 1 | |
| fi | |
| if ! gh auth status >/dev/null 2>&1; then | |
| echo "Error: gh CLI is not authenticated. Run 'gh auth login' first." >&2 | |
| exit 1 | |
| fi | |
| # --- Detect platform --- | |
| OS="$(uname -s)" | |
| ARCH="$(uname -m)" | |
| case "$OS" in | |
| Darwin) OS="darwin" ;; | |
| Linux) OS="linux" ;; | |
| *) | |
| echo "Error: Unsupported operating system: $OS" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| case "$ARCH" in | |
| x86_64) ARCH="amd64" ;; | |
| aarch64) ARCH="arm64" ;; | |
| arm64) ARCH="arm64" ;; | |
| *) | |
| echo "Error: Unsupported architecture: $ARCH" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| # --- Resolve version --- | |
| if [ -z "${VERSION:-}" ]; then | |
| VERSION="$(gh release view --repo "$REPO" --json tagName --jq .tagName 2>/dev/null)" || true | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Could not determine latest release version." >&2 | |
| echo "Check https://github.com/${REPO}/releases" >&2 | |
| exit 1 | |
| fi | |
| fi | |
| TARBALL="dawn-${OS}-${ARCH}.tar.gz" | |
| echo "Installing dawn ${VERSION} (${OS}/${ARCH})..." | |
| # --- Download and extract --- | |
| TMPDIR="$(mktemp -d)" | |
| trap 'rm -rf "$TMPDIR"' EXIT | |
| if ! gh release download "$VERSION" --repo "$REPO" --pattern "$TARBALL" --dir "$TMPDIR"; then | |
| echo "Error: Failed to download ${TARBALL} from ${REPO}." >&2 | |
| echo "Check that the release exists and has a ${TARBALL} asset." >&2 | |
| exit 1 | |
| fi | |
| tar -xzf "${TMPDIR}/${TARBALL}" -C "$TMPDIR" | |
| # --- Install --- | |
| mkdir -p "$INSTALL_DIR" | |
| mv "${TMPDIR}/dawn" "${INSTALL_DIR}/dawn" | |
| chmod +x "${INSTALL_DIR}/dawn" | |
| echo "Installed dawn to ${INSTALL_DIR}/dawn" | |
| # --- PATH check --- | |
| case ":${PATH}:" in | |
| *":${INSTALL_DIR}:"*) ;; | |
| *) | |
| echo "" | |
| echo "Add ${INSTALL_DIR} to your PATH:" | |
| echo "" | |
| echo " export PATH=\"${INSTALL_DIR}:\$PATH\"" | |
| echo "" | |
| echo "Add the line above to your shell profile (~/.bashrc, ~/.zshrc, etc.)" | |
| ;; | |
| esac | |
| # --- Verify --- | |
| if command -v dawn >/dev/null 2>&1; then | |
| echo "" | |
| dawn version | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment