Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a06a02927c | |||
| 1c14a59764 |
@@ -39,8 +39,10 @@ jobs:
|
||||
cp deploy/client-build/package.json "$B/package.json"
|
||||
cd "$B"
|
||||
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
|
||||
./node_modules/.bin/pkg daemon.cjs --targets node22-linux-arm64 --output out/agent-helm-linux-arm64
|
||||
# --no-bytecode: skeppa JS-källa i st.f. arch-specifik V8-bytecode, så att
|
||||
# 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
|
||||
cd out && sha256sum agent-helm-linux-* install.sh > checksums.txt && ls -la
|
||||
|
||||
@@ -53,10 +55,15 @@ jobs:
|
||||
run: |
|
||||
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"
|
||||
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)
|
||||
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
|
||||
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')
|
||||
[ -z "$rid" ] && rid=$(curl -s "$API/repos/$REPO/releases/tags/$TAG" -H "Authorization: token $TOKEN" | jq -r '.id')
|
||||
echo "release id: $rid"
|
||||
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 ..."
|
||||
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
|
||||
|
||||
13
install.sh
13
install.sh
@@ -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; }
|
||||
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}"
|
||||
SUDO=""
|
||||
if [ "$(id -u)" = 0 ] || [ -w "$PREFIX/bin" ]; then
|
||||
if [ "$(id -u)" = 0 ] || { mkdir -p "$PREFIX/bin" 2>/dev/null && [ -w "$PREFIX/bin" ]; }; then
|
||||
BIN="$PREFIX/bin"
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
BIN="$PREFIX/bin"; SUDO=sudo
|
||||
else
|
||||
BIN="$HOME/.local/bin"; mkdir -p "$BIN"
|
||||
BIN="$HOME/.local/bin"
|
||||
fi
|
||||
mkdir -p "$BIN"
|
||||
|
||||
echo "agent-helm: hämtar $ASSET ($TAG) -> $BIN/agent-helm"
|
||||
tmp=$(mktemp)
|
||||
curl -fSL "$URL" -o "$tmp"
|
||||
chmod +x "$tmp"
|
||||
$SUDO install -m 0755 "$tmp" "$BIN/agent-helm"
|
||||
install -m 0755 "$tmp" "$BIN/agent-helm"
|
||||
rm -f "$tmp"
|
||||
|
||||
# --- config ---
|
||||
|
||||
Reference in New Issue
Block a user