diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml new file mode 100644 index 0000000..7397553 --- /dev/null +++ b/.github/workflows/patch.yml @@ -0,0 +1,79 @@ +name: Patch Revanced & Revanced Extended +on: + schedule: + - cron: "0 0 */5 * *" + workflow_dispatch: +jobs: + patch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up jdk + uses: actions/setup-java@v3.10.0 + with: + distribution: 'zulu' + java-version: '17' + + - name: Patch Revanced & Revanced Extended non-root + run: bash patch.sh + + - name: Generate Changelog + run: | + curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest \ + | grep "browser_download_url.*json" \ + | cut -d : -f 2,3 \ + | tr -d \" \ + | wget -qi - + RVVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json) + rm -rf patches.json + + curl -s https://api.github.com/repos/inotia00/revanced-patches/releases/latest \ + | grep "browser_download_url.*json" \ + | cut -d : -f 2,3 \ + | tr -d \" \ + | wget -qi - + RVEVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json) + rm -rf patches.json + echo "Download Below :point_down:" > ${{ github.workspace }}-CHANGELOG.txt + echo "INFO-RV=Revanced-v${RVVERSION}" >> $GITHUB_ENV + echo "INFO-RVE=Revanced Extended-v${RVEVERSION}" >> $GITHUB_ENV + + - name: Delete Release + uses: dev-drprasad/delete-older-releases@v0.2.0 + with: + repo: ${{ github.repository }} + keep_latest: 0 + delete_tag_pattern: "*" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release Revanced + uses: softprops/action-gh-release@v1 + with: + files: yt-revanced.apk + name: ${{ env.INFO-RV }} + tag_name: Revanced + body_path: ${{ github.workspace }}-CHANGELOG.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release Revanced Extended + uses: softprops/action-gh-release@v1 + with: + files: yt-revanced-extended.apk + name: ${{ env.INFO-RVE }} + tag_name: Revanced-Extended + body_path: ${{ github.workspace }}-CHANGELOG.txt + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 5 + keep_minimum_runs: 5 +permissions: + contents: write