Xbox Cloud Gaming app for PS5 Homebrew
C
feat(release): enforce tri-platform standard (PS5, PS4, Linux) with automated verifier
Rafael Abud Ferreira8d95cd3e7998
diff --git a/tools/publish-release.sh b/tools/publish-release.shnew file mode 100755index 0000000..9c8a28b--- /dev/null+++ b/tools/publish-release.sh@@ -0,0 +1,167 @@+#!/usr/bin/env bash+# SPDX-License-Identifier: GPL-3.0-or-later+# Copyright (C) 2026 RafaelNGP+#+# Master Release Publisher - Tri-Platform Guaranteed (PS5 + PS4 + Linux)+#+# Workflow:+# 1. Runs tools/release.sh to build PS5 and PS4 packages, perform security/hygiene checks.+# 2. Verifies notes.md is bilingual and up to date.+# 3. Tags the commit and pushes to origin.+# 4. Creates GitHub release with PS5 (PPSA99810.zip*) and PS4 (PSBoxCloudGaming[PS4]-vX.Y.Z.pkg*).+# 5. Monitors GitHub Actions until the Linux AppImage is built on Ubuntu 24.04 and attached.+# 6. Automatically signs the Linux AppImage using tools/desktop/sign-linux-release.sh.+# 7. Executes tools/release-verify.sh --verify-sigs to enforce 100% compliance.+#+# Usage:+# tools/publish-release.sh <X.Y.Z> [--skip-build] [--yes]+#+set -euo pipefail++root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)+cd "$root"++raw_version="${1:?usage: tools/publish-release.sh <X.Y.Z> [--skip-build] [--yes]}"+shift || true++skip_build=0+auto_confirm=0+for arg in "$@"; do+ case "$arg" in+ --skip-build) skip_build=1 ;;+ --yes|-y) auto_confirm=1 ;;+ *) echo "warning: unknown argument '$arg'" >&2 ;;+ esac+done++version="${raw_version#v}"+tag="v$version"+out="$root/build-ps5/release-$tag"++RED='\033[0;31m'+GREEN='\033[0;32m'+YELLOW='\033[1;33m'+BLUE='\033[0;34m'+BOLD='\033[1m'+NC='\033[0m'++echo -e "${BOLD}${BLUE}======================================================${NC}"+echo -e "${BOLD}${BLUE} PSBox Cloud Gaming: Tri-Platform Release Publisher ${NC}"+echo -e "${BOLD}${BLUE} Target: $tag (PS5 + PS4 + Linux AppImage) ${NC}"+echo -e "${BOLD}${BLUE}======================================================${NC}"++# Check release notes+[[ -f "$root/notes.md" ]] || { echo -e "${RED}error: notes.md not found${NC}" >&2; exit 1; }+grep -q "<!-- LANG:EN -->" "$root/notes.md" || { echo -e "${RED}error: notes.md missing <!-- LANG:EN -->${NC}" >&2; exit 1; }+grep -q "<!-- LANG:PT -->" "$root/notes.md" || { echo -e "${RED}error: notes.md missing <!-- LANG:PT -->${NC}" >&2; exit 1; }++# Phase 1: Build & Package PS5 and PS4+if [[ $skip_build -eq 0 ]]; then+ echo+ echo -e "${BOLD}Phase 1: Building and packaging PS5 and PS4...${NC}"+ tools/release.sh "$version" "$out"+else+ echo+ echo -e "${YELLOW}Phase 1: Skipping build (reusing $out)...${NC}"+fi++# Verify local artifacts exist+[[ -s "$out/PPSA99810.zip" ]] || { echo -e "${RED}error: $out/PPSA99810.zip missing${NC}" >&2; exit 1; }+[[ -s "$out/PPSA99810.zip.sha256" ]] || { echo -e "${RED}error: $out/PPSA99810.zip.sha256 missing${NC}" >&2; exit 1; }+[[ -s "$out/PPSA99810.zip.sig" ]] || { echo -e "${RED}error: $out/PPSA99810.zip.sig missing${NC}" >&2; exit 1; }+ps4_pkg="$out/PSBoxCloudGaming[PS4]-$tag.pkg"+[[ -s "$ps4_pkg" ]] || { echo -e "${RED}error: $ps4_pkg missing${NC}" >&2; exit 1; }+[[ -s "$ps4_pkg.sha256" ]] || { echo -e "${RED}error: $ps4_pkg.sha256 missing${NC}" >&2; exit 1; }++echo+echo -e "${GREEN}Local artifacts for PS5 and PS4 are ready and validated.${NC}"++# Confirmation prompt+if [[ $auto_confirm -eq 0 ]]; then+ echo+ read -rp "Publish release $tag to GitHub now? [y/N] " confirm+ if [[ ! "$confirm" =~ ^[yY]([eE][sS])?$ ]]; then+ echo "Aborted by user."+ exit 0+ fi+fi++# Phase 2: Git Tag+echo+echo -e "${BOLD}Phase 2: Tagging and pushing $tag...${NC}"+if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then+ echo "Note: tag $tag already exists locally."+else+ git tag -a "$tag" -m "PSBox Cloud Gaming $tag"+fi+git push origin "$tag"++# Phase 3: GitHub Release Creation (PS5 + PS4)+echo+echo -e "${BOLD}Phase 3: Creating GitHub Release $tag with PS5 and PS4 assets...${NC}"+# Use [[]PS4] escaping to prevent Go filepath.Glob from treating [PS4] as a regex character set+gh release create "$tag" \+ "$out/PPSA99810.zip" \+ "$out/PPSA99810.zip.sha256" \+ "$out/PPSA99810.zip.sig" \+ "$out/PSBoxCloudGaming[[]PS4]-$tag.pkg" \+ "$out/PSBoxCloudGaming[[]PS4]-$tag.pkg.sha256" \+ --target "$(git rev-parse HEAD)" \+ --title "PSBox Cloud Gaming $tag" \+ --notes-file "$root/notes.md" 2>/dev/null || {+ echo "Release $tag might already exist; updating assets..."+ gh release upload "$tag" \+ "$out/PPSA99810.zip" \+ "$out/PPSA99810.zip.sha256" \+ "$out/PPSA99810.zip.sig" \+ "$out/PSBoxCloudGaming[[]PS4]-$tag.pkg" \+ "$out/PSBoxCloudGaming[[]PS4]-$tag.pkg.sha256" \+ --clobber+ gh release edit "$tag" --notes-file "$root/notes.md"+}++# Phase 4: Wait for Linux AppImage from GitHub Actions+echo+echo -e "${BOLD}Phase 4: Waiting for Linux AppImage build (CI: .github/workflows/release-linux.yml)...${NC}"+linux_name="PSBox-$tag-linux-x86_64.AppImage"+timeout_secs=900 # 15 minutes max+elapsed=0+interval=15++while true; do+ assets_json=$(gh release view "$tag" --json assets 2>/dev/null || echo '{"assets":[]}')+ has_appimage=$(echo "$assets_json" | jq -r --arg n "$linux_name" '.assets[] | select(.name == $n and .state == "uploaded") | .name')+ if [[ -n "$has_appimage" ]]; then+ echo -e "${GREEN}Linux AppImage is uploaded on GitHub: $linux_name${NC}"+ break+ fi++ if (( elapsed >= timeout_secs )); then+ echo -e "${RED}Timed out waiting for Linux AppImage after $((timeout_secs / 60)) minutes!${NC}" >&2+ echo "You can check GitHub Actions workflow status and re-run:" >&2+ echo " gh workflow view release-linux.yml" >&2+ echo " tools/desktop/sign-linux-release.sh $tag" >&2+ echo " tools/release-verify.sh $tag --verify-sigs" >&2+ exit 1+ fi++ echo "Waiting for $linux_name to be uploaded by CI... (${elapsed}s elapsed)"+ sleep "$interval"+ elapsed=$((elapsed + interval))+done++# Phase 5: Cryptographic Signature of Linux AppImage+echo+echo -e "${BOLD}Phase 5: Signing Linux AppImage with local release key...${NC}"+tools/desktop/sign-linux-release.sh "$tag"++# Phase 6: Final Tri-Platform Audit+echo+echo -e "${BOLD}Phase 6: Executing final release audit...${NC}"+tools/release-verify.sh "$tag" --verify-sigs++echo+echo -e "${BOLD}${GREEN}======================================================${NC}"+echo -e "${BOLD}${GREEN} RELEASE $tag PUBLISHED AND VERIFIED SUCCESSFULLY! ${NC}"+echo -e "${BOLD}${GREEN} All 3 platforms (PS5, PS4, Linux) are complete. ${NC}"+echo -e "${BOLD}${GREEN}======================================================${NC}"diff --git a/tools/release-verify.sh b/tools/release-verify.shnew file mode 100755index 0000000..9ef855b--- /dev/null+++ b/tools/release-verify.sh@@ -0,0 +1,252 @@+#!/usr/bin/env bash+# SPDX-License-Identifier: GPL-3.0-or-later+# Copyright (C) 2026 RafaelNGP+#+# Release Verifier - Enforces the Tri-Platform Release Standard+# Every published release (vX.Y.Z) MUST contain assets for:+# 1. PlayStation 5 (PPSA99810.zip + .sha256 + .sig)+# 2. PlayStation 4 (PSBoxCloudGaming[PS4]-vX.Y.Z.pkg + .sha256)+# 3. Linux AppImage (PSBox-vX.Y.Z-linux-x86_64.AppImage + .sha256 + .sig)+#+# Usage:+# tools/release-verify.sh <vX.Y.Z|X.Y.Z> [--verify-sigs]+#+set -euo pipefail++root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)+raw_tag="${1:?usage: tools/release-verify.sh <vX.Y.Z|X.Y.Z> [--verify-sigs]}"+verify_sigs=0+if [[ "${2:-}" == "--verify-sigs" || "${1:-}" == "--verify-sigs" ]]; then+ verify_sigs=1+fi++tag="$raw_tag"+[[ "$tag" == v* ]] || tag="v$tag"+version="${tag#v}"++RED='\033[0;31m'+GREEN='\033[0;32m'+YELLOW='\033[1;33m'+BLUE='\033[0;34m'+BOLD='\033[1m'+NC='\033[0m'++pass() { echo -e " [${GREEN}✓${NC}] $*"; }+warn() { echo -e " [${YELLOW}!${NC}] $*"; }+fail() { echo -e " [${RED}✗${NC}] $*"; }++echo -e "${BOLD}${BLUE}=== Verifying Release $tag (Tri-Platform Standard) ===${NC}"++# Fetch release metadata from GitHub+json=$(gh release view "$tag" --json tagName,isDraft,isPrerelease,body,assets 2>&1) || {+ echo -e "${RED}Error: Release $tag not found on GitHub or gh CLI failed.${NC}" >&2+ echo "$json" >&2+ exit 1+}++# 1. Draft / Pre-release check+is_draft=$(echo "$json" | jq -r '.isDraft')+is_prerelease=$(echo "$json" | jq -r '.isPrerelease')++if [[ "$is_draft" == "true" ]]; then+ fail "Release $tag is marked as DRAFT"+ exit 1+fi+pass "Release $tag is published (not draft)"++# 2. Bilingual Release Notes Check+body=$(echo "$json" | jq -r '.body // ""')+errors=0++if grep -q "<!-- LANG:EN -->" <<<"$body" && grep -q "<!-- LANG:PT -->" <<<"$body"; then+ pass "Release notes: Bilingual markers (EN/PT) present"+else+ warn "Release notes: Missing <!-- LANG:EN --> or <!-- LANG:PT --> markers"+fi++if grep -iq "PS5" <<<"$body" && grep -iq "PS4" <<<"$body" && grep -iq "Linux" <<<"$body"; then+ pass "Release notes: Installation instructions present for PS5, PS4, and Linux"+else+ warn "Release notes: Missing explicit installation instructions for all 3 platforms"+fi++# Parse assets+asset_names=$(echo "$json" | jq -r '.assets[].name')++find_asset() {+ local pattern="$1"+ echo "$asset_names" | grep -E "$pattern" | head -1 || true+}++get_asset_size() {+ local name="$1"+ echo "$json" | jq -r --arg n "$name" '.assets[] | select(.name == $n) | .size // 0'+}++get_asset_state() {+ local name="$1"+ echo "$json" | jq -r --arg n "$name" '.assets[] | select(.name == $n) | .state // ""'+}++echo+echo -e "${BOLD}Target 1: PlayStation 5 (PS5)${NC}"+ps5_zip=$(find_asset '^PPSA99810\.zip$')+ps5_sha=$(find_asset '^PPSA99810\.zip\.sha256$')+ps5_sig=$(find_asset '^PPSA99810\.zip\.sig$')++if [[ -n "$ps5_zip" ]]; then+ sz=$(get_asset_size "$ps5_zip")+ st=$(get_asset_state "$ps5_zip")+ mb=$(awk -v s="$sz" 'BEGIN { printf "%.2f", s / 1048576 }')+ if (( sz > 10000000 )) && [[ "$st" == "uploaded" ]]; then+ pass "PPSA99810.zip ($mb MB, state: $st)"+ else+ fail "PPSA99810.zip is too small or not fully uploaded ($sz bytes, state: $st)"+ errors=$((errors + 1))+ fi+else+ fail "PPSA99810.zip is MISSING"+ errors=$((errors + 1))+fi++if [[ -n "$ps5_sha" ]]; then+ pass "PPSA99810.zip.sha256 present"+else+ fail "PPSA99810.zip.sha256 is MISSING"+ errors=$((errors + 1))+fi++if [[ -n "$ps5_sig" ]]; then+ sz=$(get_asset_size "$ps5_sig")+ if (( sz > 0 )); then+ pass "PPSA99810.zip.sig present ($sz bytes)"+ else+ fail "PPSA99810.zip.sig is empty"+ errors=$((errors + 1))+ fi+else+ fail "PPSA99810.zip.sig is MISSING (Console updater requires .sig!)"+ errors=$((errors + 1))+fi++echo+echo -e "${BOLD}Target 2: PlayStation 4 (PS4)${NC}"+# GitHub sanitizes [PS4] to .PS4., so we match both literal [PS4] and .PS4.+ps4_pkg=$(find_asset '^(PSBoxCloudGaming(\[PS4\]|\.PS4\.)-v'"$version"'\.pkg|PSBoxCloudGaming-v'"$version"'-ps4\.pkg)$')+ps4_sha=$(find_asset '^(PSBoxCloudGaming(\[PS4\]|\.PS4\.)-v'"$version"'\.pkg\.sha256|PSBoxCloudGaming-v'"$version"'-ps4\.pkg\.sha256)$')++if [[ -n "$ps4_pkg" ]]; then+ sz=$(get_asset_size "$ps4_pkg")+ st=$(get_asset_state "$ps4_pkg")+ mb=$(awk -v s="$sz" 'BEGIN { printf "%.2f", s / 1048576 }')+ if (( sz > 5000000 )) && [[ "$st" == "uploaded" ]]; then+ pass "$ps4_pkg ($mb MB, state: $st)"+ else+ fail "$ps4_pkg is too small or not fully uploaded ($sz bytes, state: $st)"+ errors=$((errors + 1))+ fi+else+ fail "PS4 PKG package is MISSING (expected PSBoxCloudGaming[PS4]-$tag.pkg)"+ errors=$((errors + 1))+fi++if [[ -n "$ps4_sha" ]]; then+ pass "$ps4_sha present"+else+ fail "PS4 PKG sha256 checksum is MISSING"+ errors=$((errors + 1))+fi++echo+echo -e "${BOLD}Target 3: Linux Desktop (AppImage)${NC}"+linux_app=$(find_asset '^PSBox-v'"$version"'-linux-x86_64\.AppImage$')+linux_sha=$(find_asset '^PSBox-v'"$version"'-linux-x86_64\.AppImage\.sha256$')+linux_sig=$(find_asset '^PSBox-v'"$version"'-linux-x86_64\.AppImage\.sig$')++if [[ -n "$linux_app" ]]; then+ sz=$(get_asset_size "$linux_app")+ st=$(get_asset_state "$linux_app")+ mb=$(awk -v s="$sz" 'BEGIN { printf "%.2f", s / 1048576 }')+ if (( sz > 4000000 )) && [[ "$st" == "uploaded" ]]; then+ pass "$linux_app ($mb MB, state: $st)"+ else+ fail "$linux_app is too small or not fully uploaded ($sz bytes, state: $st)"+ errors=$((errors + 1))+ fi+else+ fail "Linux AppImage is MISSING (expected PSBox-$tag-linux-x86_64.AppImage)"+ echo -e " ${YELLOW}Hint: Run the 'Release (Linux)' workflow via:${NC}"+ echo -e " gh workflow run release-linux.yml -f tag=$tag"+ errors=$((errors + 1))+fi++if [[ -n "$linux_sha" ]]; then+ pass "$linux_sha present"+else+ fail "Linux AppImage sha256 checksum is MISSING"+ errors=$((errors + 1))+fi++if [[ -n "$linux_sig" ]]; then+ sz=$(get_asset_size "$linux_sig")+ if (( sz > 0 )); then+ pass "$linux_sig present ($sz bytes)"+ else+ fail "$linux_sig is empty"+ errors=$((errors + 1))+ fi+else+ fail "Linux AppImage signature (.sig) is MISSING"+ echo -e " ${YELLOW}Hint: Sign the downloaded AppImage using:${NC}"+ echo -e " tools/desktop/sign-linux-release.sh $tag"+ errors=$((errors + 1))+fi++# Optional cryptographic signature verification+if [[ $verify_sigs -eq 1 && $errors -eq 0 ]]; then+ echo+ echo -e "${BOLD}Cryptographic Signature Verification${NC}"+ work=$(mktemp -d)+ trap 'rm -rf "$work"' EXIT++ # Extract public key from updater.cpp+ pubkey="$work/pubkey.pem"+ awk '/BEGIN PUBLIC KEY/,/END PUBLIC KEY/' "$root/src/app/updater.cpp" | sed 's/^[[:space:]]*"//; s/\\n".*//' > "$pubkey"++ if [[ -s "$pubkey" ]]; then+ # Verify PS5 signature+ gh release download "$tag" -p "PPSA99810.zip" -p "PPSA99810.zip.sig" -D "$work" >/dev/null 2>&1+ if openssl dgst -sha256 -verify "$pubkey" -signature "$work/PPSA99810.zip.sig" "$work/PPSA99810.zip" >/dev/null 2>&1; then+ pass "PS5 package cryptographic signature verified"+ else+ fail "PS5 package signature DOES NOT verify against updater.cpp public key!"+ errors=$((errors + 1))+ fi++ # Verify Linux signature+ gh release download "$tag" -p "$linux_app" -p "$linux_sig" -D "$work" >/dev/null 2>&1+ if openssl dgst -sha256 -verify "$pubkey" -signature "$work/$linux_sig" "$work/$linux_app" >/dev/null 2>&1; then+ pass "Linux AppImage cryptographic signature verified"+ else+ fail "Linux AppImage signature DOES NOT verify against updater.cpp public key!"+ errors=$((errors + 1))+ fi+ else+ warn "Could not extract public key from src/app/updater.cpp"+ fi+fi++echo+if [[ $errors -eq 0 ]]; then+ echo -e "${BOLD}${GREEN}======================================================${NC}"+ echo -e "${BOLD}${GREEN} RELEASE $tag VERIFICATION PASSED (TRI-PLATFORM OK) ${NC}"+ echo -e "${BOLD}${GREEN} ✓ PS5 ✓ PS4 ✓ Linux AppImage ${NC}"+ echo -e "${BOLD}${GREEN}======================================================${NC}"+ exit 0+else+ echo -e "${BOLD}${RED}======================================================${NC}"+ echo -e "${BOLD}${RED} RELEASE $tag VERIFICATION FAILED ($errors ERRORS FOUND) ${NC}"+ echo -e "${BOLD}${RED} One or more mandatory platform assets are missing! ${NC}"+ echo -e "${BOLD}${RED}======================================================${NC}"+ exit 1+fidiff --git a/tools/release.sh b/tools/release.shindex d1bc1da..5e07c4c 100755--- a/tools/release.sh+++ b/tools/release.sh@@ -125,6 +125,32 @@ for f in assets/cacert.pem licenses/THIRD_PARTY_NOTICES.md licenses/FFmpeg-LGPL-doneok "certificates and licenses in place"+echo "== build PS4"+if [ -z "${OO_PS4_TOOLCHAIN:-}" ] && [ -d "$root/ps4-toolchain" ]; then+ export OO_PS4_TOOLCHAIN="$root/ps4-toolchain"+fi+[[ -d "${OO_PS4_TOOLCHAIN:-}" ]] || fail "PS4 toolchain not found at OO_PS4_TOOLCHAIN or $root/ps4-toolchain"+ps4_buildlog=$(mktemp)+cmake --build build-ps4 -j"$(nproc)" >"$ps4_buildlog" 2>&1 || { cat "$ps4_buildlog"; rm -f "$ps4_buildlog"; fail "the PS4 build failed"; }+rm -f "$ps4_buildlog"+ps4_ver=$(printf '%02d.%02d' "$major" "$((minor * 10 + patch))")+ps4_out="$out/ps4_pkg"+XC_PS4_VERSION="$ps4_ver" tools/ps4/package.sh build-ps4 "$ps4_out" >/dev/null++ps4_pkg_name="PSBoxCloudGaming[PS4]-$tag.pkg"+mv -f "$ps4_out/PSBox Cloud Gaming - PS4.pkg" "$out/$ps4_pkg_name"+rm -rf "$ps4_out"+(cd "$out" && sha256sum "$ps4_pkg_name" > "$ps4_pkg_name.sha256")+ok "$out/$ps4_pkg_name ($(du -h "$out/$ps4_pkg_name" | cut -f1)), sha256 $(cut -d' ' -f1 "$out/$ps4_pkg_name.sha256")"++echo "== checks in the PS4 package"+ps4_eboot="$root/build-ps4/pkg_stage/eboot.bin"+if grep -aqE "$tokens" "$ps4_eboot"; then fail "PS4 eboot.bin holds something like a token"; fi+ok "PS4 eboot.bin: no token"+ps4_sfo="$root/build-ps4/pkg_stage/sce_sys/param.sfo"+grep -aq "$ps4_ver" "$ps4_sfo" || fail "PS4 param.sfo doesn't carry version $ps4_ver"+ok "PS4 param.sfo: version $ps4_ver confirmed"+linux_assets=""if [[ $linux == 1 ]]; thenecho "== Linux package"@@ -167,7 +193,18 @@ if [[ $console == 1 ]]; thenfiecho "== all checks passed; to publish (with release notes in notes.md):"-echo " gh release create $tag \"$zip\" \"$out/PPSA99810.zip.sha256\" \"$out/PPSA99810.zip.sig\"$linux_assets --target $(git rev-parse HEAD) --title \"PSBox Cloud Gaming $tag\" --notes-file notes.md"+echo " gh release create $tag \\"+echo " \"$zip\" \"$out/PPSA99810.zip.sha256\" \"$out/PPSA99810.zip.sig\" \\"+echo " \"$out/PSBoxCloudGaming[[]PS4]-$tag.pkg\" \"$out/PSBoxCloudGaming[[]PS4]-$tag.pkg.sha256\"$linux_assets \\"+echo " --target $(git rev-parse HEAD) --title \"PSBox Cloud Gaming $tag\" --notes-file notes.md"+echo+echo "== post-release steps (Mandatory Tri-Platform Standard):"+echo " 1. GitHub Actions will build Linux AppImage via .github/workflows/release-linux.yml."+echo " 2. Once uploaded by CI, sign it:"+echo " tools/desktop/sign-linux-release.sh $tag"+echo " 3. Verify all 3 platforms (PS5, PS4, Linux AppImage) and signatures:"+echo " tools/release-verify.sh $tag --verify-sigs"+echoecho "== catalog record (apps/PPSA99810.json):"echo " \"version\": \"$version\","echo " \"artifact_url\": \"https://github.com/RafaelNGP/xbox-cloud-gaming-ps5/releases/download/$tag/PPSA99810.zip\","