From b1ee5ca4e5434487f15a57de45d806c25162fd0c Mon Sep 17 00:00:00 2001 From: Achille <58356637+SharkBoy69-CS@users.noreply.github.com> Date: Thu, 9 Mar 2023 09:38:33 +0100 Subject: [PATCH] Cleaned and squashed commits Cleaned for lineage 21.0 releases --- changelog.txt | 5 +++++ lavender.json | 13 +++++++++++++ release.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 changelog.txt create mode 100644 lavender.json create mode 100755 release.sh diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..7ca9a02 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,5 @@ +Highlights & Device Specific Changes: +Build type: Unofficial +Device: Redmi Note 7 (lavender) +Device maintainer: 0xsharkboy + diff --git a/lavender.json b/lavender.json new file mode 100644 index 0000000..301fcbd --- /dev/null +++ b/lavender.json @@ -0,0 +1,13 @@ +{ + "response": [ + { + "datetime": "", + "filename": "", + "id": "", + "romtype": "", + "size": "", + "url": "", + "version": "" + } + ] +} diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..b984b63 --- /dev/null +++ b/release.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +if [ -z "$1" ] ; then + echo "Usage: $0 " + exit 1 +fi + +ROM="$1" + +METADATA=$(unzip -p "$ROM" META-INF/com/android/metadata) +SDK_LEVEL=$(echo "$METADATA" | grep post-sdk-level | cut -f2 -d '=') +TIMESTAMP=$(echo "$METADATA" | grep post-timestamp | cut -f2 -d '=') + +FILENAME=$(basename $ROM) +DEVICE=$(echo $FILENAME | cut -f5 -d '-' | cut -f1 -d".") +ROMTYPE=$(echo $FILENAME | cut -f4 -d '-') +DATE=$(echo $FILENAME | cut -f3 -d '-') +ID=$(echo ${TIMESTAMP}${DEVICE}${SDK_LEVEL} | sha256sum | cut -f 1 -d ' ') +SIZE=$(du -b $ROM | cut -f1 -d ' ') +TYPE=$(echo $FILENAME | cut -f4 -d '-') +VERSION=$(echo $FILENAME | cut -f2 -d '-') +RELASE_TAG=${DEVICE}_lineage-${VERSION}_${TIMESTAMP} + +URL="https://github.com/0xsharkboy/Lineage_OTA/releases/download/${RELASE_TAG}/${FILENAME}" + +response=$(jq -n --arg datetime $TIMESTAMP \ + --arg filename $FILENAME \ + --arg id $ID \ + --arg romtype $ROMTYPE \ + --arg size $SIZE \ + --arg url $URL \ + --arg version $VERSION \ + '$ARGS.named' +) +wrapped_response=$(jq -n --argjson response "[$response]" '$ARGS.named') + +echo "$wrapped_response" > $DEVICE.json +git add $DEVICE.json +git commit -m "Update autogenerated json for $DEVICE $VERSION ${DATE}/${TIMESTAMP}" +git push + +gh release create $RELASE_TAG $ROM --notes "Automated release for $DEVICE $VERSION ${DATE}/${TIMESTAMP}"