feat(release): publish to public devbox-dist repo (no-token curl|sh) 🌐📦
Some checks are pending
CI / vet-build-test (push) Waiting to run
Some checks are pending
CI / vet-build-test (push) Waiting to run
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.
This commit is contained in:
parent
9b1165a49a
commit
3a0ec9740e
4 changed files with 38 additions and 26 deletions
|
|
@ -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):
|
**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
|
```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
|
# non-interactive: DEVBOX_BIN_DIR=~/.local/bin DEVBOX_SERVICE=1 sh install.sh
|
||||||
# also install the hub: sh install.sh --hub
|
# also install the hub: sh install.sh --hub
|
||||||
```
|
```
|
||||||
|
|
||||||
<details><summary>🪟 Windows · 🍎 macOS Full Disk Access · 🛠️ knobs</summary>
|
<details><summary>🪟 Windows · 🍎 macOS Full Disk Access · 🛠️ knobs</summary>
|
||||||
|
|
||||||
- **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.
|
- **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`.
|
- **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).
|
- **Service control:** `systemctl --user {status,disable} devbox` (Linux) · `launchctl unload ~/Library/LaunchAgents/ai.shoemoney.devbox.plist` (mac).
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
logon and restarts it on failure.
|
logon and restarts it on failure.
|
||||||
|
|
||||||
.EXAMPLE
|
.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 -BinDir "$env:LOCALAPPDATA\Programs\devbox" -Service
|
||||||
.\install.ps1 -Hub # also install devbox-hub.exe
|
.\install.ps1 -Hub # also install devbox-hub.exe
|
||||||
#>
|
#>
|
||||||
|
|
@ -15,7 +15,7 @@ param(
|
||||||
[switch]$Hub,
|
[switch]$Hub,
|
||||||
[switch]$Service,
|
[switch]$Service,
|
||||||
[switch]$NoService,
|
[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"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# a location you choose, and (optionally) sets up a keep-alive auto-restart service
|
# a location you choose, and (optionally) sets up a keep-alive auto-restart service
|
||||||
# so the sync daemon survives crashes and reboots.
|
# 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 # interactive: pick dir, offer service
|
||||||
# sh install.sh --hub --service # also install the hub + enable the 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
|
# 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}"
|
INSTALL_HUB="${DEVBOX_INSTALL_HUB:-0}"
|
||||||
BIN_DIR="${DEVBOX_BIN_DIR:-}"
|
BIN_DIR="${DEVBOX_BIN_DIR:-}"
|
||||||
WANT_SERVICE="${DEVBOX_SERVICE:-ask}"
|
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
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,25 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
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 # (re)publish the moving 'latest' release
|
||||||
# ./scripts/release.sh v1.0.0 # cut a versioned release (creates the git tag at HEAD)
|
# ./scripts/release.sh v1.0.0 # cut a versioned release
|
||||||
#
|
#
|
||||||
# Builds every target via build-release.sh, then creates/updates the Forgejo release
|
# Builds every target here (private source repo), then publishes to the PUBLIC
|
||||||
# and uploads assets under the *de-versioned* names install.sh downloads:
|
# devbox-dist repo so `curl|sh` works without a token. Assets carry the
|
||||||
# devbox_<os>_<arch> devbox-hub_<os>_<arch> (+ .exe on windows) + SHA256SUMS
|
# de-versioned names install.sh downloads, plus the installers themselves:
|
||||||
|
# install.sh install.ps1 devbox_<os>_<arch> devbox-hub_<os>_<arch> SHA256SUMS
|
||||||
#
|
#
|
||||||
# Auth: ~/.config/forgejo/token (or $FORGEJO_TOKEN). Override host/repo with
|
# Auth: ~/.config/forgejo/token (or $FORGEJO_TOKEN). Override with FORGEJO_API /
|
||||||
# FORGEJO_API / REPO if you ever move the remote.
|
# REPO (publish target) / DIST_BRANCH if the dist repo ever moves.
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
TAG="${1:-latest}"
|
TAG="${1:-latest}"
|
||||||
API="${FORGEJO_API:-https://git.shoemoney.ai/api/v1}"
|
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)}"
|
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; }
|
[ -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
|
curl -fsSL -X DELETE "${auth[@]}" "$API/repos/$REPO/tags/$TAG" >/dev/null 2>&1 || true
|
||||||
fi
|
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)
|
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" \
|
rel_id=$(api -X POST "$API/repos/$REPO/releases" \
|
||||||
-H 'Content-Type: application/json' \
|
-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"])')
|
| python3 -c 'import sys,json;print(json.load(sys.stdin)["id"])')
|
||||||
echo "✅ release '$TAG' created (id $rel_id)"
|
echo "✅ release '$TAG' created (id $rel_id)"
|
||||||
|
|
||||||
# 4. Upload de-versioned assets. dist names are <bin>_<version>_<os>_<arch>[.exe].
|
# 4. Upload de-versioned assets. dist names are <bin>_<version>_<os>_<arch>[.exe].
|
||||||
upload() {
|
# deversion <basename> -> <bin>_<os>_<arch>[.exe] (the name install.sh fetches).
|
||||||
local f="$1" base ext arch rest os bin name
|
deversion() {
|
||||||
base=$(basename "$f"); ext=""
|
local base="$1" ext="" arch rest os bin
|
||||||
case "$base" in *.exe) ext=".exe"; base="${base%.exe}";; esac
|
case "$base" in *.exe) ext=".exe"; base="${base%.exe}";; esac
|
||||||
arch="${base##*_}"; rest="${base%_*}"
|
arch="${base##*_}"; rest="${base%_*}"
|
||||||
os="${rest##*_}"; bin="${rest%_*}"; bin="${bin%_*}" # strip version component
|
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"
|
echo " ⬆ $name"
|
||||||
api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$name" \
|
api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=$name" -F "attachment=@$1" >/dev/null
|
||||||
-F "attachment=@$f" >/dev/null
|
|
||||||
}
|
}
|
||||||
for f in dist/devbox_* dist/devbox-hub_*; do [ -f "$f" ] && upload "$f"; done
|
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"
|
echo " ⬆ SHA256SUMS"
|
||||||
api -X POST "$API/repos/$REPO/releases/$rel_id/assets?name=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
|
||||||
echo "🎉 https://git.shoemoney.ai/$REPO/releases/tag/$TAG"
|
echo "🎉 https://git.shoemoney.ai/$REPO/releases/tag/$TAG"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue