diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9defbf..9bb4afb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,18 +11,22 @@ jobs: - name: Checkout uses: actions/checkout@v3 - run: ./build.sh all + env: + GITHUB_REPOSITORY: $GITHUB_REPOSITORY - id: get_output run: | - YT_FILE=$(find . -maxdepth 1 -name "yt-revanced-magisk-*.zip" -printf '%P') - echo ::set-output name=YT_OUTPUT::$YT_FILE + echo ::set-output name=YT_OUTPUT::$(find . -maxdepth 1 -name "yt-revanced-magisk-*.zip" -printf '%P') + echo ::set-output name=MUSIC_OUTPUT::$(find . -maxdepth 1 -name "music-revanced-magisk-*.zip" -printf '%P') + BUILD_LOG=$(cat build.log) BUILD_LOG="${BUILD_LOG//'%'/'%25'}" BUILD_LOG="${BUILD_LOG//$'\n'/'%0A'}" BUILD_LOG="${BUILD_LOG//$'\r'/'%0D'}" echo ::set-output name=BUILD_LOG::$BUILD_LOG - echo ::set-output name=DATE::$(date +'%Y-%m-%d') + echo ::set-output name=DATE::$(date +'%Y%m%d') shell: bash + - name: Upload modules to release uses: svenstaro/upload-release-action@v2 with: @@ -32,3 +36,33 @@ jobs: release_name: ${{ steps.get_output.outputs.YT_OUTPUT }} tag: ${{ steps.get_output.outputs.DATE }} file_glob: true + overwrite: true + + - id: update_config + run: | + echo "${{ steps.get_output.outputs.BUILD_LOG }}" >latest_build.log + CHANGELOG_URL="https://raw.githubusercontent.com/$GITHUB_REPOSITORY/update/latest_build.log" + get_update_json() { + echo "{ + \"version\": \"v$1\", + \"versionCode\": $2, + \"zipUrl\": \"$3\", + \"changelog\": \"$4\" + }" + } + YT_VER=$(echo "${{ steps.get_output.outputs.BUILD_LOG }}" | sed -n 's/.*YouTube version: \(.*\)/\1/p') + YT_DLURL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.get_output.outputs.DATE }}/${{ steps.get_output.outputs.YT_OUTPUT }}" + UPDATE_YT_JSON=$(get_update_json $YT_VER ${{ steps.get_output.outputs.DATE }} $YT_DLURL $CHANGELOG_URL) + echo "$UPDATE_YT_JSON" >yt-update.json + + MUSIC_VER=$(echo "${{ steps.get_output.outputs.BUILD_LOG }}" | sed -n 's/.*Music version: \(.*\)/\1/p') + MUSIC_DLURL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.get_output.outputs.DATE }}/${{ steps.get_output.outputs.MUSIC_OUTPUT }}" + UPDATE_MUSIC_JSON=$(get_update_json $MUSIC_VER ${{ steps.get_output.outputs.DATE }} $MUSIC_DLURL $CHANGELOG_URL) + echo "$UPDATE_MUSIC_JSON" >music-update.json + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: update + create_branch: true + file_pattern: latest_build.log music-update.json yt-update.json + push_options: "--force" diff --git a/README.md b/README.md index 9869778..a13c9a6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repo includes a simple script that downloads all the latest version of necessary prebuilt revanced tools and the stock APKs of YouTube and YouTube Music from APKMirror, applies the patches and creates magisk modules -You will need to install the stock YouTube app matching with the module's version on your phone using an installer like [SAI](https://play.google.com/store/apps/details?id=com.aefyr.sai&hl=tr&gl=US) **with the split APKs**. +You will need to install the stock YouTube app matching with the module's version on your phone using an installer like [SAI](https://play.google.com/store/apps/details?id=com.aefyr.sai) **with the split APKs**. You can go grab the split APKs from APKMirror (the bundle, not the apk or it will crash). The link is also provided in release notes. You can get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases) from here. @@ -13,7 +13,7 @@ You can get the [latest CI release](https://github.com/j-hc/revanced-magisk-modu Reflashing in Magisk sometimes breaks modules for some reason. In that case just remove the module, reboot and flash again. ### Note -I exclude some patches to my liking. If you want to change them: +If you wish to include/exclude some patches to your liking: * Fork the repo * Edit the patcher args in [`build.sh`](./build.sh) * Start the workflow to build diff --git a/build.sh b/build.sh index 597f63a..f2fe1a5 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ set -e source utils.sh -YT_PATCHER_ARGS="-e microg-support -e premium-heading -e fenster-swipe-controls -e hdr-max-brightness" +YT_PATCHER_ARGS="-e microg-support" MUSIC_PATCHER_ARGS="-e microg-support" BUILD_YT=false diff --git a/utils.sh b/utils.sh index 999de59..5764f08 100755 --- a/utils.sh +++ b/utils.sh @@ -86,7 +86,7 @@ build_yt() { fi yt_patched_apk="${TEMP_DIR}/yt-revanced-base.apk" - java -jar $RV_CLI_JAR -a $yt_base_apk -c -o $yt_patched_apk -b $RV_PATCHES_JAR -m $RV_INTEGRATIONS_APK $1 + java -jar $RV_CLI_JAR -a $yt_base_apk -c -o $yt_patched_apk -b $RV_PATCHES_JAR -m $RV_INTEGRATIONS_APK -e premium-heading $1 mv -f "$yt_patched_apk" "${MODULE_TEMPLATE_DIR}/base.apk" echo "Creating the magisk module for YouTube..." @@ -153,16 +153,20 @@ yt_module_prop() { echo "id=ytrv-magisk name=YouTube ReVanced version=v${1} -versionCode=1 +versionCode=$(date +'%Y%m%d') author=j-hc -description=mounts base.apk for YouTube ReVanced" >"${MODULE_TEMPLATE_DIR}/module.prop" +description=mounts base.apk for YouTube ReVanced +updateJson=https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/update/yt-update.json +" >"${MODULE_TEMPLATE_DIR}/module.prop" } music_module_prop() { echo "id=ytmusicrv-magisk name=YouTube Music ReVanced version=v${1} -versionCode=1 +versionCode=$(date +'%Y%m%d') author=j-hc -description=mounts base.apk for YouTube Music ReVanced" >"${MODULE_TEMPLATE_DIR}/module.prop" +description=mounts base.apk for YouTube Music ReVanced +updateJson=https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/update/music-update.json +" >"${MODULE_TEMPLATE_DIR}/module.prop" }