2 Commits

Author SHA1 Message Date
a06a02927c release: bygg pkg med --no-bytecode (cross-arch utan QEMU) + idempotent asset-upload
All checks were successful
build-and-push / build (push) Successful in 9s
release-client / build-release (push) Successful in 50s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 17:30:53 +02:00
1c14a59764 install.sh: ingen sudo (mkdir bin först; ~/.local/bin-fallback; sudo sh för system-wide)
All checks were successful
build-and-push / build (push) Successful in 10s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 17:28:49 +02:00
2 changed files with 17 additions and 11 deletions

View File

@@ -39,8 +39,10 @@ jobs:
cp deploy/client-build/package.json "$B/package.json" cp deploy/client-build/package.json "$B/package.json"
cd "$B" cd "$B"
npm install --ignore-scripts --no-audit --no-fund @homebridge/node-pty-prebuilt-multiarch@0.13.1 @yao-pkg/pkg@6.20.0 npm install --ignore-scripts --no-audit --no-fund @homebridge/node-pty-prebuilt-multiarch@0.13.1 @yao-pkg/pkg@6.20.0
./node_modules/.bin/pkg daemon.cjs --targets node22-linux-x64 --output out/agent-helm-linux-x64 # --no-bytecode: skeppa JS-källa i st.f. arch-specifik V8-bytecode, så att
./node_modules/.bin/pkg daemon.cjs --targets node22-linux-arm64 --output out/agent-helm-linux-arm64 # BÅDA arkitekturerna kan cross-byggas på samma (arm64) runner utan QEMU.
./node_modules/.bin/pkg daemon.cjs --no-bytecode --public --public-packages '*' --targets node22-linux-x64 --output out/agent-helm-linux-x64
./node_modules/.bin/pkg daemon.cjs --no-bytecode --public --public-packages '*' --targets node22-linux-arm64 --output out/agent-helm-linux-arm64
cp "$GITHUB_WORKSPACE/install.sh" out/install.sh cp "$GITHUB_WORKSPACE/install.sh" out/install.sh
cd out && sha256sum agent-helm-linux-* install.sh > checksums.txt && ls -la cd out && sha256sum agent-helm-linux-* install.sh > checksums.txt && ls -la
@@ -53,10 +55,15 @@ jobs:
run: | run: |
B=/tmp/clientbuild/out B=/tmp/clientbuild/out
BODY="agent-helm klient $TAG — sjalvstandiga binarer (linux x64/arm64). Installera: curl -fsSL https://gitea.brasse-pc.eu/brasse/agent-helm/raw/branch/main/install.sh | sh" BODY="agent-helm klient $TAG — sjalvstandiga binarer (linux x64/arm64). Installera: curl -fsSL https://gitea.brasse-pc.eu/brasse/agent-helm/raw/branch/main/install.sh | sh"
rid=$(curl -s -X POST "$API/repos/$REPO/releases" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"$BODY\"}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) rid=$(curl -s -X POST "$API/repos/$REPO/releases" -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"$BODY\"}" | jq -r '.id // empty')
if [ -z "$rid" ]; then rid=$(curl -s "$API/repos/$REPO/releases/tags/$TAG" -H "Authorization: token $TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2); fi [ -z "$rid" ] && rid=$(curl -s "$API/repos/$REPO/releases/tags/$TAG" -H "Authorization: token $TOKEN" | jq -r '.id')
echo "release id: $rid" echo "release id: $rid"
for f in agent-helm-linux-x64 agent-helm-linux-arm64 install.sh checksums.txt; do for f in agent-helm-linux-x64 agent-helm-linux-arm64 install.sh checksums.txt; do
aid=$(curl -s "$API/repos/$REPO/releases/$rid/assets" -H "Authorization: token $TOKEN" | jq -r ".[] | select(.name==\"$f\") | .id")
if [ -n "$aid" ] && [ "$aid" != "null" ]; then
echo "ersätter befintlig $f (id $aid)"
curl -s -X DELETE "$API/repos/$REPO/releases/$rid/assets/$aid" -H "Authorization: token $TOKEN" -o /dev/null
fi
echo "laddar upp $f ..." echo "laddar upp $f ..."
curl -s -X POST "$API/repos/$REPO/releases/$rid/assets?name=$f" -H "Authorization: token $TOKEN" -F "attachment=@$B/$f" -o /dev/null -w " -> HTTP %{http_code}\n" curl -s -X POST "$API/repos/$REPO/releases/$rid/assets?name=$f" -H "Authorization: token $TOKEN" -F "attachment=@$B/$f" -o /dev/null -w " -> HTTP %{http_code}\n"
done done

View File

@@ -32,22 +32,21 @@ TAG=$(curl -fsSL "$API/releases/latest" | tr ',' '\n' | grep -m1 '"tag_name"' |
[ -n "${TAG:-}" ] || { echo "agent-helm: hittade ingen release på $BASE"; exit 1; } [ -n "${TAG:-}" ] || { echo "agent-helm: hittade ingen release på $BASE"; exit 1; }
URL="$BASE/$OWNER/$REPO/releases/download/$TAG/$ASSET" URL="$BASE/$OWNER/$REPO/releases/download/$TAG/$ASSET"
# --- bin-katalog (root -> /usr/local/bin, annars sudo, annars ~/.local/bin) --- # --- bin-katalog: /usr/local/bin om root/skrivbar, annars ~/.local/bin (ingen sudo).
# För system-wide utan att vara root: curl -fsSL ... | sudo sh
PREFIX="${PREFIX:-/usr/local}" PREFIX="${PREFIX:-/usr/local}"
SUDO="" if [ "$(id -u)" = 0 ] || { mkdir -p "$PREFIX/bin" 2>/dev/null && [ -w "$PREFIX/bin" ]; }; then
if [ "$(id -u)" = 0 ] || [ -w "$PREFIX/bin" ]; then
BIN="$PREFIX/bin" BIN="$PREFIX/bin"
elif command -v sudo >/dev/null 2>&1; then
BIN="$PREFIX/bin"; SUDO=sudo
else else
BIN="$HOME/.local/bin"; mkdir -p "$BIN" BIN="$HOME/.local/bin"
fi fi
mkdir -p "$BIN"
echo "agent-helm: hämtar $ASSET ($TAG) -> $BIN/agent-helm" echo "agent-helm: hämtar $ASSET ($TAG) -> $BIN/agent-helm"
tmp=$(mktemp) tmp=$(mktemp)
curl -fSL "$URL" -o "$tmp" curl -fSL "$URL" -o "$tmp"
chmod +x "$tmp" chmod +x "$tmp"
$SUDO install -m 0755 "$tmp" "$BIN/agent-helm" install -m 0755 "$tmp" "$BIN/agent-helm"
rm -f "$tmp" rm -f "$tmp"
# --- config --- # --- config ---