fix: resolve latest release dynamically in installers (was hardcoded v0.2.0)
CI / Lint (push) Failing after 9m35s
CI / Test (push) Failing after 6m4s
CI / Build (darwin/amd64) (push) Skipped
CI / Build (linux/amd64) (push) Skipped
CI / Build (windows/amd64) (push) Skipped
CI / Build (darwin/arm64) (push) Skipped
CI / Build (linux/arm64) (push) Skipped
CI / Build (windows/arm64) (push) Skipped
CI / Release (push) Skipped

This commit is contained in:
2026-08-14 11:32:19 -04:00
parent 919c6f0040
commit 52823109bc
2 changed files with 33 additions and 2 deletions
+14 -1
View File
@@ -8,8 +8,21 @@
$ErrorActionPreference = 'Stop'
$Version = if ($env:CLIP_SYNC_VERSION) { $env:CLIP_SYNC_VERSION } else { 'v0.2.0' }
$Version = if ($env:CLIP_SYNC_VERSION) { $env:CLIP_SYNC_VERSION } else { 'latest' }
$Repo = 'https://git.dracodev.net/Projets/clip-sync'
$ApiBase = 'https://git.dracodev.net/api/v1/repos/Projets/clip-sync'
# ── Resolve version ───────────────────────────────────────────────────
if ($Version -eq 'latest') {
try {
$release = Invoke-RestMethod "$ApiBase/releases/latest" -UseBasicParsing
$Version = $release.tag_name
if (-not $Version) { throw 'no tag_name' }
} catch {
throw "clip-sync: no release found. Publish one (git tag v0.2.0 && git push origin v0.2.0), or build from source: git clone $Repo && cd clip-sync && make install"
}
}
# ── Detect architecture ───────────────────────────────────────────────
+19 -1
View File
@@ -8,12 +8,27 @@
set -euo pipefail
REPO="https://git.dracodev.net/Projets/clip-sync"
VERSION="${CLIP_SYNC_VERSION:-v0.2.0}"
API_BASE="https://git.dracodev.net/api/v1/repos/Projets/clip-sync"
VERSION="${CLIP_SYNC_VERSION:-latest}"
BINARY="clip-sync"
INSTALL_DIR="${HOME}/.local/bin"
CONFIG_DIR="${HOME}/.config/clip-sync"
CONFIG_FILE="${CONFIG_DIR}/peers.toml"
# ── Resolve version ────────────────────────────────────────────────────
resolve_version() {
if [ "$VERSION" = "latest" ]; then
VERSION="$(curl -fsSL "${API_BASE}/releases/latest" \
| sed -n 's/.*"tag_name":"\([^"]*\)".*/\1/p' | head -n1)"
if [ -z "$VERSION" ]; then
echo "clip-sync: no release found. Publish one (git tag v0.2.0 && git push origin v0.2.0)" >&2
echo " or build from source: git clone ${REPO} && cd clip-sync && make install" >&2
exit 1
fi
fi
}
# ── Detect platform ────────────────────────────────────────────────────
detect_platform() {
@@ -127,9 +142,12 @@ main() {
mkdir -p "${INSTALL_DIR}"
resolve_version
local platform
platform=$(detect_platform)
echo "clip-sync: detected platform: ${platform}"
echo "clip-sync: version: ${VERSION}"
download_binary "${platform}"
create_config