Files
kestrove-desktop/scripts/gitea-release.sh
T
samiandClaude Opus 5.5 722e6cefc4
ci / build (ubuntu-22.04) (push) Canceled after 0s
ci / build (windows-2025) (push) Canceled after 0s
ci / deny (push) Canceled after 0s
Linux release: .deb and .rpm (AppImage needs a real x86_64 host)
linuxdeploy and the AppImage runtime can't run under QEMU (amd64 emulation on Apple silicon). The build
is split into cached steps; the release script uploads .rpm too. The .deb installs cleanly on Debian 12.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 16:59:46 +09:00

31 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Creates (or reuses) the Gitea release for this version and uploads the desktop bundles to it.
#
# GITEA_TOKEN=… scripts/gitea-release.sh [dir-with-files] (default ../release/desktop)
#
# GITEA_TOKEN: a Gitea access token with the write:repository scope (Settings → Applications). The tag
# v<version> must already be pushed. Files: *.AppImage, *.deb, *.rpm, *-setup.exe, kestrove-nmh-*, SHA256SUMS.
set -eu
cd "$(dirname "$0")/.."
: "${GITEA_TOKEN:?set GITEA_TOKEN (Gitea → Settings → Applications → token with write:repository)}"
API=${GITEA_API:-https://gitea.samialabri.com/api/v1}
REPO=${GITEA_REPO:-kestrove/kestrove-desktop}
DIR=${1:-../release/desktop}
V=$(node -p 'require("./package.json").version')
TAG="v$V"
AUTH="Authorization: token $GITEA_TOKEN"
(cd "$DIR" && rm -f SHA256SUMS && shasum -a 256 -- *.AppImage *.deb *.rpm *-setup.exe kestrove-nmh-* 2>/dev/null > SHA256SUMS; cat SHA256SUMS)
ID=$(curl -fsS -H "$AUTH" "$API/repos/$REPO/releases/tags/$TAG" 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{console.log(JSON.parse(s).id||"")}catch{console.log("")}})')
if [ -z "$ID" ]; then
BODY=$(node -e 'console.log(JSON.stringify({tag_name: process.argv[1], name: "Kestrove " + process.argv[2], body: "Kestrove desktop " + process.argv[2] + " for Windows and Linux. On a Mac, use the Kestrove app from the Mac App Store instead.\n\nVerify downloads with SHA256SUMS.", draft: false, prerelease: false}))' "$TAG" "$V")
ID=$(curl -fsS -X POST -H "$AUTH" -H "Content-Type: application/json" -d "$BODY" "$API/repos/$REPO/releases" | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>console.log(JSON.parse(s).id))')
fi
for f in "$DIR"/*.AppImage "$DIR"/*.deb "$DIR"/*.rpm "$DIR"/*-setup.exe "$DIR"/kestrove-nmh-* "$DIR"/SHA256SUMS; do
[ -f "$f" ] || continue
echo "uploading $(basename "$f")"
curl -fsS -X POST -H "$AUTH" -F "attachment=@$f" "$API/repos/$REPO/releases/$ID/assets?name=$(basename "$f")" >/dev/null
done
echo "Release: ${API%/api/v1}/$REPO/releases/tag/$TAG"