Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolga077 committed Jun 27, 2022
0 parents commit e271b66
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ReVanced Build

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: "17"
distribution: "adopt"

- name: Download Stored base APKs
uses: robinraju/[email protected]
with:
repository: ${{ github.repository }}
tag: 'base'
fileName: "*"
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build APKs
run: ./build_revanced.sh

- name: Set current date as env variable
run: echo "date_now=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
draft: true
title: "Release ${{ env.date_now }}"
files: |
build/*.apk
vanced-microG.apk
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.apk
*.jar
apkeep
*.dex
revanced-cache/
build/
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Revanced Build
This repo template will allow you to build ReVanced using Github Actions. This will helps people who don't want to setup build environments on their machines.
By default this will build ReVanced with ALL available patches. You can modify the `build_revanced.sh` script to limit to only patches you want to use.

## Notes
- Current implementation cannot download the latest compatible versions of Youtube and Youtube Music, as APKPure either doesn't have bundled APK, or doesn't have older versions of the apps that are compatible with ReVanced.
- While this template will build Revanced Music Non-root, it won't work as current patches doesn't include the Music Non-root (microG) patch (track [this commit](https://github.com/revanced/revanced-patches/commit/e22060b52cf09b5b6fe08d5b9ffb8f102efc6cf5) when it will get merged to `main` and released). Don't open an issue here. Just rebuild ReVanced when music microG patch is available on [ReVanced Patches](https://github.com/revanced/revanced-patches/releases).
- Under NO CIRCUMSTANCES any APKs will be uploaded to this repository to avoid DMCA.

## How to setup
1. Fork or create a new repository using this repository as a template ([Guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)). DO NOT FORK if you need to set the new repo to private.
2. Download latest (compatible) APKs of Youtube and Youtube Music from APKMirror.com:
- [Youtube 17.24.35](https://www.apkmirror.com/apk/google-inc/youtube/youtube-17-24-35-release/youtube-17-24-35-android-apk-download/)
- Rename to `com.google.android.youtube.apk`
- [Youtube Music 5.03.50](https://www.apkmirror.com/apk/google-inc/youtube-music/youtube-music-5-03-50-release/)
- Choose correct version according to your device architecture
- Rename to `com.google.android.apps.youtube.music.apk`
3. Publish a new release under tag `base` and upload the APKs to the release. ([Step 1](images/release_1.png), [Step 2](images/release_2.png))

## How to build
1. Go to Actions -> All workflows -> ReVanced Build ([Example](images/workflow_run.png))
2. Run the workflow
3. Download the APKs from the draft releases ([Example](images/build_release.png))


93 changes: 93 additions & 0 deletions build_revanced.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash

# Latest compatible version of apks
# YouTube Music 5.03.50
# YouTube 17.24.35
# Vanced microG 0.2.24.220220

YTM_VERSION="5.03.50"
YT_VERSION="17.24.35"
VMG_VERSION="0.2.24.220220"

# Artifacts associative array aka dictionary
declare -A artifacts

artifacts["revanced-cli.jar"]="revanced/revanced-cli revanced-cli .jar"
artifacts["revanced-integrations.apk"]="revanced/revanced-integrations app-release-unsigned .apk"
artifacts["revanced-patches.jar"]="revanced/revanced-patches revanced-patches .jar"
artifacts["apkeep"]="EFForg/apkeep apkeep-x86_64-unknown-linux-gnu"

get_artifact_download_url () {
# Usage: get_download_url <repo_name> <artifact_name> <file_type>
local api_url="https://api.github.com/repos/$1/releases/latest"
local result=$(curl $api_url | jq ".assets[] | select(.name | contains(\"$2\") and contains(\"$3\") and (contains(\".sig\") | not)) | .browser_download_url")
echo ${result:1:-1}
}

# Fetch all the dependencies
for artifact in "${!artifacts[@]}"; do
if [ ! -f $artifact ]; then
echo "Downloading $artifact"
curl -L -o $artifact $(get_artifact_download_url ${artifacts[$artifact]})
fi
done

# Fetch microG
chmod +x apkeep

# ./apkeep -a [email protected] com.google.android.youtube
# ./apkeep -a [email protected] com.google.android.apps.youtube.music

if [ ! -f "vanced-microG.apk" ]; then
echo "Downloading Vanced microG"
./apkeep -a com.mgoogle.android.gms@$VMG_VERSION .
mv com.mgoogle.android.gms@$VMG_VERSION.apk vanced-microG.apk
fi

# if [ -f "com.google.android.youtube.xapk" ]
# then
# unzip com.google.android.youtube.xapk -d youtube
# yt_apk_path="youtube/com.google.android.youtube.apk"
# elif [ -f "com.google.android.youtube.apk" ]
# then
# yt_apk_path="com.google.android.youtube.apk"
# else
# echo "Cannot find APK"
# fi

echo "************************************"
echo "Building YouTube APK"
echo "************************************"

mkdir -p build
# Obtained from: revanced-patches-1.9.1
# available_patches="-e amoled -e minimized-playback -e disable-create-button -e premium-heading -e custom-branding -e disable-shorts-button -e disable-fullscreen-panels -e old-quality-layout -e hide-cast-button -e microg-support -e general-ads -e video-ads -e seekbar-tapping -e upgrade-button-remover -e tasteBuilder-remover -e background-play -e exclusive-audio-playback -e codecs-unlock"

if [ -f "com.google.android.youtube.apk" ]
then
echo "Building Root APK"
java -jar revanced-cli.jar -m revanced-integrations.apk -b revanced-patches.jar --mount \
-e microg-support \
-a com.google.android.youtube.apk -o build/revanced-root.apk
echo "Building Non-root APK"
java -jar revanced-cli.jar -m revanced-integrations.apk -b revanced-patches.jar \
-a com.google.android.youtube.apk -o build/revanced-nonroot.apk
else
echo "Cannot find YouTube APK, skipping build"
fi
echo ""
echo "************************************"
echo "Building YouTube Music APK"
echo "************************************"
if [ -f "com.google.android.apps.youtube.music.apk" ]
then
echo "Building Root APK"
java -jar revanced-cli.jar -b revanced-patches.jar --mount \
-e microg-support \
-a com.google.android.apps.youtube.music.apk -o build/revanced-music-root.apk
echo "Building Non-root APK"
java -jar revanced-cli.jar -b revanced-patches.jar \
-a com.google.android.apps.youtube.music.apk -o build/revanced-music-nonroot.apk
else
echo "Cannot find YouTube Music APK, skipping build"
fi
Binary file added images/build_release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/release_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/release_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/workflow_run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e271b66

Please sign in to comment.