From a06a02927ced8a87bcac92f28cc7f2ec20cd7ee9 Mon Sep 17 00:00:00 2001 From: Bjorn Blomberg Date: Sun, 28 Jun 2026 17:30:53 +0200 Subject: [PATCH] release: bygg pkg med --no-bytecode (cross-arch utan QEMU) + idempotent asset-upload Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/release.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 4395d0b..4ef16a8 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -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