From 3a0ec9740ee825f98b8e22a93893b0b6ee5d31fc Mon Sep 17 00:00:00 2001 From: shoemoney Date: Tue, 23 Jun 2026 18:12:09 -0500 Subject: [PATCH] =?UTF-8?q?feat(release):=20publish=20to=20public=20devbox?= =?UTF-8?q?-dist=20repo=20(no-token=20curl|sh)=20=F0=9F=8C=90=F0=9F=93=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Private code stays private; the public shoemoney/devbox-dist repo carries only the install scripts + release binaries as release assets, so a clean Pi/box can: curl -fsSL .../devbox-dist/releases/download/latest/install.sh | sh with no auth. release.sh now targets devbox-dist (tags hang off its branch), uploads install.sh/install.ps1 alongside the binaries, and rewrites SHA256SUMS to the de-versioned asset names so shasum -c matches. install.sh/install.ps1/README point at the new public URLs. --- README.md | 4 ++-- install.ps1 | 4 ++-- install.sh | 4 ++-- scripts/release.sh | 52 ++++++++++++++++++++++++++++------------------ 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 5b4945f..b098c5f 100644 --- a/README.md +++ b/README.md @@ -284,14 +284,14 @@ The offline edit is **never lost** โ€” it just lands as a clearly-named sibling. **Client (macOS / Linux)** โ€” one line. Detects your platform, lets you pick where the binary lives, and offers a **keep-alive auto-restart service** (launchd `KeepAlive` on mac, systemd `Restart=always` on Linux): ```bash -curl -fsSL https://git.shoemoney.ai/shoemoney/devbox/raw/branch/main/install.sh | sh +curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.sh | sh # non-interactive: DEVBOX_BIN_DIR=~/.local/bin DEVBOX_SERVICE=1 sh install.sh # also install the hub: sh install.sh --hub ```
๐ŸชŸ Windows ยท ๐ŸŽ macOS Full Disk Access ยท ๐Ÿ› ๏ธ knobs -- **Windows:** `irm https://git.shoemoney.ai/shoemoney/devbox/raw/branch/main/install.ps1 | iex` โ€” copies `devbox.exe`, adds it to PATH, and (optionally) a restart-on-failure **Scheduled Task** at logon. Notes Controlled Folder Access if you have it on. +- **Windows:** `irm https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.ps1 | iex` โ€” copies `devbox.exe`, adds it to PATH, and (optionally) a restart-on-failure **Scheduled Task** at logon. Notes Controlled Folder Access if you have it on. - **macOS Full Disk Access:** to sync `~/Desktop`, `~/Documents`, `~/Downloads`, or **iCloud**, grant Full Disk Access to the `devbox` binary (System Settings โ†’ Privacy & Security โ†’ Full Disk Access). `devbox doctor` tests your actual mounts and tells you the exact fix + a deep link โ€” a background daemon can't show the per-folder prompt, so without it those mounts silently fail. - **Knobs:** `--bin-dir DIR` ยท `--hub` ยท `--service` / `--no-service` ยท `--release-url URL` (or the `DEVBOX_*` env equivalents). No prebuilt release? The script falls back to a local `dist/` (run `scripts/build-release.sh`) or `go build`. - **Service control:** `systemctl --user {status,disable} devbox` (Linux) ยท `launchctl unload ~/Library/LaunchAgents/ai.shoemoney.devbox.plist` (mac). diff --git a/install.ps1 b/install.ps1 index 3395ca8..59bd732 100644 --- a/install.ps1 +++ b/install.ps1 @@ -6,7 +6,7 @@ logon and restarts it on failure. .EXAMPLE - irm https://git.shoemoney.ai/shoemoney/devbox/raw/branch/main/install.ps1 | iex + irm https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.ps1 | iex .\install.ps1 -BinDir "$env:LOCALAPPDATA\Programs\devbox" -Service .\install.ps1 -Hub # also install devbox-hub.exe #> @@ -15,7 +15,7 @@ param( [switch]$Hub, [switch]$Service, [switch]$NoService, - [string]$ReleaseUrl = $(if ($env:DEVBOX_RELEASE_URL) { $env:DEVBOX_RELEASE_URL } else { "https://git.shoemoney.ai/shoemoney/devbox/releases/download/latest" }) + [string]$ReleaseUrl = $(if ($env:DEVBOX_RELEASE_URL) { $env:DEVBOX_RELEASE_URL } else { "https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest" }) ) $ErrorActionPreference = "Stop" diff --git a/install.sh b/install.sh index a00e7f6..2c33261 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ # a location you choose, and (optionally) sets up a keep-alive auto-restart service # so the sync daemon survives crashes and reboots. # -# curl -fsSL https://git.shoemoney.ai/shoemoney/devbox/raw/branch/main/install.sh | sh +# curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.sh | sh # sh install.sh # interactive: pick dir, offer service # sh install.sh --hub --service # also install the hub + enable the service # DEVBOX_BIN_DIR=~/.local/bin DEVBOX_SERVICE=1 sh install.sh # non-interactive @@ -15,7 +15,7 @@ set -eu INSTALL_HUB="${DEVBOX_INSTALL_HUB:-0}" BIN_DIR="${DEVBOX_BIN_DIR:-}" WANT_SERVICE="${DEVBOX_SERVICE:-ask}" -RELEASE_URL="${DEVBOX_RELEASE_URL:-https://git.shoemoney.ai/shoemoney/devbox/releases/download/latest}" +RELEASE_URL="${DEVBOX_RELEASE_URL:-https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest}" while [ $# -gt 0 ]; do case "$1" in diff --git a/scripts/release.sh b/scripts/release.sh index ca2d1f9..a25daaf 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,23 +1,25 @@ #!/usr/bin/env bash set -euo pipefail -# One-shot local release to Forgejo. No CI runner required. +# One-shot local release. No CI runner required. # -# ./scripts/release.sh # (re)publish the moving 'latest' release from HEAD -# ./scripts/release.sh v1.0.0 # cut a versioned release (creates the git tag at HEAD) +# ./scripts/release.sh # (re)publish the moving 'latest' release +# ./scripts/release.sh v1.0.0 # cut a versioned release # -# Builds every target via build-release.sh, then creates/updates the Forgejo release -# and uploads assets under the *de-versioned* names install.sh downloads: -# devbox__ devbox-hub__ (+ .exe on windows) + SHA256SUMS +# Builds every target here (private source repo), then publishes to the PUBLIC +# devbox-dist repo so `curl|sh` works without a token. Assets carry the +# de-versioned names install.sh downloads, plus the installers themselves: +# install.sh install.ps1 devbox__ devbox-hub__ SHA256SUMS # -# Auth: ~/.config/forgejo/token (or $FORGEJO_TOKEN). Override host/repo with -# FORGEJO_API / REPO if you ever move the remote. +# Auth: ~/.config/forgejo/token (or $FORGEJO_TOKEN). Override with FORGEJO_API / +# REPO (publish target) / DIST_BRANCH if the dist repo ever moves. cd "$(dirname "$0")/.." TAG="${1:-latest}" API="${FORGEJO_API:-https://git.shoemoney.ai/api/v1}" -REPO="${REPO:-shoemoney/devbox}" +REPO="${REPO:-shoemoney/devbox-dist}" # public distribution repo (releases live here) +DIST_BRANCH="${DIST_BRANCH:-main}" # tags hang off this branch in the dist repo TOKEN="${FORGEJO_TOKEN:-$(cat ~/.config/forgejo/token 2>/dev/null || true)}" [ -n "$TOKEN" ] || { echo "๐Ÿ›‘ no Forgejo token (set FORGEJO_TOKEN or ~/.config/forgejo/token)" >&2; exit 1; } @@ -46,32 +48,42 @@ if [ "$TAG" = latest ]; then curl -fsSL -X DELETE "${auth[@]}" "$API/repos/$REPO/tags/$TAG" >/dev/null 2>&1 || true fi -# 3. Create the release (Forgejo creates the tag at $COMMIT if it doesn't exist). +# 3. Create the release. Tag hangs off the dist repo's branch (the source $COMMIT +# lives in the private repo, not here) โ€” we keep $COMMIT only for provenance. prerelease=$([ "$TAG" = latest ] && echo true || echo false) -body=$(printf 'devbox %s โ€” built %s from `%s`.\n\nInstall: `curl -fsSL https://git.shoemoney.ai/shoemoney/devbox/raw/branch/main/install.sh | sh`' "$TAG" "$(date -u +%Y-%m-%dT%H:%MZ)" "${COMMIT:0:7}") +body=$(printf 'devbox %s โ€” built %s from source `%s`.\n\nInstall: `curl -fsSL https://git.shoemoney.ai/shoemoney/devbox-dist/releases/download/latest/install.sh | sh`' "$TAG" "$(date -u +%Y-%m-%dT%H:%MZ)" "${COMMIT:0:7}") rel_id=$(api -X POST "$API/repos/$REPO/releases" \ -H 'Content-Type: application/json' \ - -d "$(python3 -c 'import json,sys; t,c,b,p=sys.argv[1:5]; print(json.dumps({"tag_name":t,"target_commitish":c,"name":t,"body":b,"draft":False,"prerelease":p=="true"}))' "$TAG" "$COMMIT" "$body" "$prerelease")" \ + -d "$(python3 -c 'import json,sys; t,c,b,p=sys.argv[1:5]; print(json.dumps({"tag_name":t,"target_commitish":c,"name":t,"body":b,"draft":False,"prerelease":p=="true"}))' "$TAG" "$DIST_BRANCH" "$body" "$prerelease")" \ | python3 -c 'import sys,json;print(json.load(sys.stdin)["id"])') echo "โœ… release '$TAG' created (id $rel_id)" # 4. Upload de-versioned assets. dist names are ___[.exe]. -upload() { - local f="$1" base ext arch rest os bin name - base=$(basename "$f"); ext="" +# deversion -> __[.exe] (the name install.sh fetches). +deversion() { + local base="$1" ext="" arch rest os bin case "$base" in *.exe) ext=".exe"; base="${base%.exe}";; esac arch="${base##*_}"; rest="${base%_*}" os="${rest##*_}"; bin="${rest%_*}"; bin="${bin%_*}" # strip version component - name="${bin}_${os}_${arch}${ext}" + printf '%s_%s_%s%s' "$bin" "$os" "$arch" "$ext" +} +upload() { + local name; name=$(deversion "$(basename "$1")") echo " โฌ† $name" - api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$name" \ - -F "attachment=@$f" >/dev/null + api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$name" -F "attachment=@$1" >/dev/null } for f in dist/devbox_* dist/devbox-hub_*; do [ -f "$f" ] && upload "$f"; done -# checksums keep their plain name +# The installers ride along as assets so `curl|sh` and `irm|iex` pull current copies. +for s in install.sh install.ps1; do + echo " โฌ† $s" + api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$s" -F "attachment=@$s" >/dev/null +done +# Rewrite SHA256SUMS to the de-versioned names so `shasum -c` matches the assets. +while read -r h n; do printf '%s %s\n' "$h" "$(deversion "$n")"; done \ + < dist/SHA256SUMS > dist/SHA256SUMS.release echo " โฌ† SHA256SUMS" api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=SHA256SUMS" \ - -F "attachment=@dist/SHA256SUMS" >/dev/null + -F "attachment=@dist/SHA256SUMS.release" >/dev/null echo echo "๐ŸŽ‰ https://git.shoemoney.ai/$REPO/releases/tag/$TAG"