vpnhide/scripts/update-json.sh
okhsunrog 5341c07781 Wire portshide into release + update-json pipeline
Mirror the kmod/zygisk plumbing so KernelSU-Next / Magisk pick up
portshide updates automatically:

- scripts/update-version.sh bumps portshide/module/module.prop along
  with the other modules when VERSION changes
- scripts/update-json.sh writes update-json/update-ports.json pointing
  at the current release zip
- CI appends updateJson=.../update-ports.json to the portshide
  module.prop before zipping, matching kmod/zygisk
- Dashboard reports portshide version mismatches as issues, with the
  same up/down/different wording the other modules use
2026-04-15 16:45:58 +03:00

54 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# Generates Magisk/KSU updateJson files pointing to the current VERSION.
# Run AFTER the GitHub release is published so zipUrl is already valid.
set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="$(tr -d '[:space:]' < VERSION)"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "error: VERSION must be MAJOR.MINOR.PATCH, got '$VERSION'" >&2
exit 1
fi
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
VERSION_CODE=$(( MAJOR * 10000 + MINOR * 100 + PATCH ))
REPO="https://github.com/okhsunrog/vpnhide"
RAW="https://raw.githubusercontent.com/okhsunrog/vpnhide/main"
echo "Generating update-json for v${VERSION} (versionCode: $VERSION_CODE)"
mkdir -p update-json
KMOD_KMIS=("android12-5.10" "android13-5.10" "android13-5.15" "android14-5.15" "android14-6.1" "android15-6.6" "android16-6.12")
for kmi in "${KMOD_KMIS[@]}"; do
cat > "update-json/update-kmod-${kmi}.json" <<EOJSON
{
"version": "v${VERSION}",
"versionCode": ${VERSION_CODE},
"zipUrl": "${REPO}/releases/download/v${VERSION}/vpnhide-kmod-${kmi}.zip",
"changelog": "${RAW}/update-json/changelog.md"
}
EOJSON
echo " update-json/update-kmod-${kmi}.json"
done
cat > "update-json/update-zygisk.json" <<EOJSON
{
"version": "v${VERSION}",
"versionCode": ${VERSION_CODE},
"zipUrl": "${REPO}/releases/download/v${VERSION}/vpnhide-zygisk.zip",
"changelog": "${RAW}/update-json/changelog.md"
}
EOJSON
echo " update-json/update-zygisk.json"
cat > "update-json/update-ports.json" <<EOJSON
{
"version": "v${VERSION}",
"versionCode": ${VERSION_CODE},
"zipUrl": "${REPO}/releases/download/v${VERSION}/vpnhide-ports.zip",
"changelog": "${RAW}/update-json/changelog.md"
}
EOJSON
echo " update-json/update-ports.json"