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
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:
+19
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user