mirror of
https://github.com/JDM170/ReVanced_Builder
synced 2025-11-29 14:41:46 +07:00
Compare commits
22 Commits
2023.03.05
...
2024.01.02
| Author | SHA1 | Date | |
|---|---|---|---|
|
8242b06085
|
|||
| bdca80cf21 | |||
| 271a6e13c6 | |||
|
7f15206c6d
|
|||
|
dab245fc0d
|
|||
|
aec3595c1f
|
|||
|
6d79dcd962
|
|||
|
c6fe465f1e
|
|||
|
7c399049ae
|
|||
|
cfce0e86f7
|
|||
| faf94e4e29 | |||
|
ad506f52ce
|
|||
|
a110a4b243
|
|||
|
71d741090a
|
|||
|
5acbf45673
|
|||
|
0429d83c29
|
|||
|
52588a3dd5
|
|||
|
c60238c508
|
|||
|
02582d4598
|
|||
|
6898697b69
|
|||
|
79ceecf058
|
|||
| ab77af47b0 |
58
.github/workflows/Build.yml
vendored
58
.github/workflows/Build.yml
vendored
@@ -1,9 +1,6 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -13,55 +10,54 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
|
||||
- name: Installing AngleSharp
|
||||
- name: Install AngleSharp
|
||||
run: |
|
||||
Install-Package AngleSharp -Source https://www.nuget.org/api/v2 -SkipDependencies -Force
|
||||
|
||||
- name: Downloading YouTube
|
||||
- name: Download YouTube
|
||||
run: |
|
||||
New-Item -Path Temp -ItemType Directory -Force
|
||||
|
||||
. Scripts\YouTube.ps1
|
||||
|
||||
- name: Downloading ReVanced CLI
|
||||
- name: Download ReVanced CLI
|
||||
run: |
|
||||
. Scripts\ReVanced_CLI.ps1
|
||||
|
||||
- name: Downloading ReVanced Patches
|
||||
- name: Download ReVanced Patches
|
||||
run: |
|
||||
. Scripts\ReVanced_Patches.ps1
|
||||
|
||||
- name: Downloading ReVanced Integrations
|
||||
- name: Download ReVanced Integrations
|
||||
run: |
|
||||
. Scripts\ReVanced_Intergrations.ps1
|
||||
|
||||
- name: Downloading Vanced MicroG
|
||||
- name: Download Vanced MicroG
|
||||
run: |
|
||||
. Scripts\MicroG.ps1
|
||||
|
||||
- name: Downloading and expanding Zulu JDK
|
||||
- name: Download and expanding Zulu JDK
|
||||
run: |
|
||||
. Scripts\Zulu_JDK.ps1
|
||||
|
||||
- name: Building
|
||||
- name: Build
|
||||
run: |
|
||||
$JavaPath = (Resolve-Path -Path "Temp\jdk_windows-x64_bin\zulu*win_x64\bin\java.exe").Path
|
||||
|
||||
& $JavaPath `
|
||||
-jar "Temp\revanced-cli.jar" `
|
||||
--apk "Temp\youtube.apk" `
|
||||
--bundle "Temp\revanced-patches.jar" `
|
||||
-jar "Temp\revanced-cli.jar" patch `
|
||||
--patch-bundle "Temp\revanced-patches.jar" `
|
||||
--merge "Temp\revanced-integrations.apk" `
|
||||
--exclude hide-time-and-seekbar `
|
||||
--exclude always-autorepeat `
|
||||
--exclude hide-captions-button `
|
||||
--exclude disable-fullscreen-panels `
|
||||
--exclude old-quality-layout `
|
||||
--clean `
|
||||
--temp-dir "Temp\Temp" `
|
||||
--out "Temp\revanced.apk"
|
||||
--exclude "always-autorepeat" `
|
||||
--exclude "hide-captions-button" `
|
||||
--exclude "hide-timestamp" `
|
||||
--exclude "hide-seekbar" `
|
||||
--purge `
|
||||
--resource-cache "Temp\Temp" `
|
||||
--out "Temp\revanced.apk" `
|
||||
"Temp\youtube.apk"
|
||||
|
||||
- name: Creating archive
|
||||
- name: Create archive
|
||||
run: |
|
||||
Get-ChildItem Temp\Temp -Recurse -Force
|
||||
$Parameters = @{
|
||||
@@ -72,25 +68,19 @@ jobs:
|
||||
}
|
||||
Compress-Archive @Parameters
|
||||
|
||||
- name: Creating Release Notes
|
||||
- name: Create Release Notes
|
||||
id: read_release
|
||||
run: |
|
||||
# https://en.wikipedia.org/wiki/Percent-encoding
|
||||
$Release = (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("`n", "%0A").replace("`r", "%0D").replace("YouTubeTag", "${{ env.LatestSupportedYT }}").replace("CLITag", "${{ env.CLIvtag }}").replace("PatchesTag", "${{ env.Patchesvtag }}").replace("IntegrationsTag", "${{ env.IntegrationsTag }}").replace("MicroGTag", "${{ env.MicroGTag }}").replace("ZuluTag", "${{ env.ZuluTag }}")
|
||||
|
||||
(Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("YouTubeTag", "${{ env.LatestSupportedYT }}").replace("CLITag", "${{ env.CLIvtag }}").replace("PatchesTag", "${{ env.Patchesvtag }}").replace("IntegrationsTag", "${{ env.IntegrationsTag }}").replace("MicroGTag", "${{ env.MicroGTag }}").replace("ZuluTag", "${{ env.ZuluTag }}") | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force
|
||||
# https://trstringer.com/github-actions-multiline-strings/
|
||||
echo "::set-output name=RELEASE_BODY::$Release"
|
||||
# echo "RELEASE_BODY=$Release" >> $GITHUB_OUTPUT
|
||||
# echo "RELEASE_BODY=$Release" >> $env:GITHUB_ENV
|
||||
|
||||
Add-Content -Path $env:GITHUB_OUTPUT -Value "ReleaseBody=ReleaseNotesTemplate.md"
|
||||
$ReleaseName = Get-Date -f "yyyy.MM.dd"
|
||||
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Uploading to Releases
|
||||
- name: Upload to Releases
|
||||
uses: softprops/action-gh-release@master
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_NAME }}
|
||||
token: ${{ github.token }}
|
||||
body_path: ${{ steps.read_release.outputs.ReleaseBody }}
|
||||
files: ReVanced.zip
|
||||
body: ${{ steps.read_release.outputs.RELEASE_BODY }}
|
||||
# body: ${{ env.RELEASE_BODY }}
|
||||
|
||||
57
Build.ps1
57
Build.ps1
@@ -18,6 +18,10 @@
|
||||
# Requires -Version 5.1
|
||||
# Doesn't work on PowerShell 7.2 due it doesn't contains IE parser engine. You have to use a 3rd party module to make it work like it's presented in CI/CD config: AngleSharp
|
||||
|
||||
# Invoke-Webrequest speedup workaround. Improved downloads speeds significantly.
|
||||
# Ref: https://www.codewrecks.com/post/azdo/pills/powershell-download/
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
# Download all files to "Script location folder\ReVanced"
|
||||
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
if (-not (Test-Path -Path "$WorkingFolder\ReVanced"))
|
||||
@@ -37,10 +41,26 @@ $versions = ($JSON | Where-Object -FilterScript {$_.compatiblePackages.name -eq
|
||||
$LatestSupported = $versions | Sort-Object -Descending -Unique | Select-Object -First 1
|
||||
$LatestSupported = $LatestSupported.replace(".", "-")
|
||||
|
||||
# Get unique key to generate direct link
|
||||
# https://www.apkmirror.com/apk/google-inc/youtube/
|
||||
# Try to find correct NON-Bundle version
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/"
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported.replace("-", ".")) (nodpi)*"}
|
||||
# Check if variable contains a data
|
||||
if ($URLParse)
|
||||
{
|
||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-android-apk-download/"
|
||||
}
|
||||
else
|
||||
{
|
||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/"
|
||||
}
|
||||
|
||||
# Get unique key to generate direct link
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
@@ -48,7 +68,7 @@ $Request = Invoke-Webrequest @Parameters
|
||||
$nameProp = $Request.ParsedHtml.getElementsByClassName("accent_bg btn btn-flat downloadButton") | ForEach-Object -Process {$_.nameProp}
|
||||
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported)-release/youtube-$($LatestSupported)-2-android-apk-download/download/$($nameProp)"
|
||||
Uri = "$($URL)/download/$($nameProp)"
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
@@ -125,6 +145,12 @@ $Parameters = @{
|
||||
}
|
||||
Invoke-RestMethod @Parameters
|
||||
|
||||
# Sometimes older version of zulu-jdk causes conflict, so remove older version before proceeding.
|
||||
if (Test-Path -Path "$WorkingFolder\ReVanced\jdk")
|
||||
{
|
||||
Remove-Item -Path "$WorkingFolder\ReVanced\jdk" -Recurse -Force
|
||||
}
|
||||
|
||||
# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json
|
||||
$Parameters = @{
|
||||
Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json"
|
||||
@@ -151,20 +177,19 @@ Expand-Archive @Parameters
|
||||
|
||||
Remove-Item -Path "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
|
||||
|
||||
# https://github.com/revanced/revanced-patches
|
||||
# Let's create patched APK
|
||||
& "$WorkingFolder\ReVanced\jdk\zulu*win_x64\bin\java.exe" `
|
||||
-jar "$WorkingFolder\ReVanced\revanced-cli.jar" `
|
||||
--apk "$WorkingFolder\ReVanced\youtube.apk" `
|
||||
--bundle "$WorkingFolder\ReVanced\revanced-patches.jar" `
|
||||
-jar "$WorkingFolder\ReVanced\revanced-cli.jar" patch `
|
||||
--patch-bundle "$WorkingFolder\ReVanced\revanced-patches.jar" `
|
||||
--merge "$WorkingFolder\ReVanced\revanced-integrations.apk" `
|
||||
--exclude hide-time-and-seekbar `
|
||||
--exclude always-autorepeat `
|
||||
--exclude hide-captions-button `
|
||||
--exclude disable-fullscreen-panels `
|
||||
--exclude old-quality-layout `
|
||||
--clean `
|
||||
--temp-dir "$WorkingFolder\ReVanced\Temp" `
|
||||
--out "$WorkingFolder\ReVanced\revanced.apk"
|
||||
--exclude "always-autorepeat" `
|
||||
--exclude "hide-captions-button" `
|
||||
--exclude "hide-timestamp" `
|
||||
--exclude "hide-seekbar" `
|
||||
--purge `
|
||||
--resource-cache "$WorkingFolder\ReVanced\Temp" `
|
||||
--out "$WorkingFolder\ReVanced\revanced.apk" `
|
||||
"$WorkingFolder\ReVanced\youtube.apk"
|
||||
|
||||
# Open working directory with builded files
|
||||
# Invoke-Item -Path "$WorkingFolder\ReVanced"
|
||||
|
||||
21
README.md
21
README.md
@@ -11,10 +11,9 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
|
||||
* To build `revanced.apk` locally you need just to run [`Build.ps1`](https://github.com/JDM170/ReVanced_Builder/blob/main/Build.ps1) via PowerShell;
|
||||
* All [patches](https://github.com/revanced/revanced-patches) except the followings applied to `revanced.apk`:
|
||||
* always-autorepeat
|
||||
* enable-wide-searchbar
|
||||
* disable-fullscreen-panels
|
||||
* premium-heading
|
||||
* tablet-mini-player
|
||||
* hide-captions-button
|
||||
* hide-timestamp
|
||||
* hide-seekbar
|
||||
* The script downloads latest available YouTube package (having parsed [JSON](https://github.com/revanced/revanced-patches/blob/main/patches.json)) supported by ReVanced Team from <https://apkmirror.com> and all dependencies and build package using [Zulu JDK](https://www.azul.com/downloads/?package=jdk);
|
||||
* Script installs no apps — everything will be held in your `Script location folder\ReVanced`;
|
||||
* After compiling you get `revanced.apk` & `microg.apk` ready to be installed;
|
||||
@@ -22,11 +21,7 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
|
||||
|
||||
### By using CI/CD
|
||||
|
||||
```powershell
|
||||
git clone https://github.com/JDM170/ReVanced_Builder
|
||||
```
|
||||
|
||||
Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflows/Build.yml) Action manually to create [release page](https://github.com/JDM170/ReVanced_Builder/releases/latest) with configured release notes showing dependencies used for building.
|
||||
Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflows/Build.yml) action manually to create [release page](https://github.com/JDM170/ReVanced_Builder/releases/latest) with configured release notes showing dependencies used for building.
|
||||
|
||||

|
||||
|
||||
@@ -41,7 +36,11 @@ Trigger the [`Build`](https://github.com/JDM170/ReVanced_Builder/actions/workflo
|
||||
|
||||
## Links
|
||||
|
||||
* [APKMirror](https://apkmirror.com)
|
||||
* [ReVanced CLI](https://github.com/revanced/revanced-cli)
|
||||
* [ReVanced Patches](https://github.com/revanced/revanced-patches)
|
||||
* [ReVanced Manager](https://github.com/revanced/revanced-manager)
|
||||
* [Telegram](https://t.me/sophia_chat)
|
||||
* [ReVanced Integrations](https://github.com/revanced/revanced-integrations)
|
||||
* [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG)
|
||||
* [AngleSharp](https://github.com/AngleSharp/AngleSharp)
|
||||
* [Zulu JDK](https://github.com/ScoopInstaller/Java)
|
||||
* [Sophia Telegram chat](https://t.me/sophia_chat)
|
||||
|
||||
@@ -4,13 +4,10 @@ $Parameters = @{
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
# $Patchesvtag = (Invoke-RestMethod @Parameters).tag_name
|
||||
# $Patchestag = $Patchesvtag.replace("v", "")
|
||||
$apiResult = Invoke-RestMethod @Parameters
|
||||
$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url
|
||||
$TAG = $apiResult.tag_name
|
||||
$Parameters = @{
|
||||
# Uri = "https://github.com/revanced/revanced-patches/releases/download/$Patchesvtag/revanced-patches-$Patchestag.jar"
|
||||
Uri = $URL
|
||||
Outfile = "Temp\revanced-patches.jar"
|
||||
UseBasicParsing = $true
|
||||
|
||||
@@ -13,24 +13,43 @@ $LatestSupportedYT = $LatestSupported.replace(".", "-")
|
||||
$AngleSharpAssemblyPath = (Get-ChildItem -Path (Split-Path -Path (Get-Package -Name AngleSharp).Source) -Filter "*.dll" -Recurse | Where-Object -FilterScript {$_ -match "standard"} | Select-Object -Last 1).FullName
|
||||
Add-Type -Path $AngleSharpAssemblyPath
|
||||
|
||||
# Get unique key to generate direct link
|
||||
# https://www.apkmirror.com/apk/google-inc/youtube/
|
||||
# Create parser object
|
||||
$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser
|
||||
|
||||
# Try to find correct NON-Bundle version
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-2-android-apk-download/"
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$URLParse = (Invoke-Webrequest @Parameters).Links.outerHTML | Where-Object -FilterScript {$_ -like "*YouTube $($LatestSupported) (nodpi)*"}
|
||||
# Check if variable contains a data
|
||||
if ($URLParse)
|
||||
{
|
||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-android-apk-download/"
|
||||
}
|
||||
else
|
||||
{
|
||||
$URL = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-2-android-apk-download/"
|
||||
}
|
||||
|
||||
# Get unique key to generate direct link
|
||||
$Parameters = @{
|
||||
Uri = $URL
|
||||
UseBasicParsing = $false # Disabled
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = (New-Object -TypeName AngleSharp.Html.Parser.HtmlParser).ParseDocument($Request.Content)
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Key = $Parsed.All | Where-Object -FilterScript {$_.ClassName -match "accent_bg btn btn-flat downloadButton"} | ForEach-Object -Process {$_.Search}
|
||||
|
||||
$Parameters = @{
|
||||
Uri = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupportedYT)-release/youtube-$($LatestSupportedYT)-2-android-apk-download/download/$($Key)"
|
||||
Uri = "$($URL)/download/$($Key)"
|
||||
UseBasicParsing = $true
|
||||
Verbose = $true
|
||||
}
|
||||
$Request = Invoke-Webrequest @Parameters
|
||||
$Parsed = (New-Object -TypeName AngleSharp.Html.Parser.HtmlParser).ParseDocument($Request.Content)
|
||||
$Parsed = $angleparser.ParseDocument($Request.Content)
|
||||
$Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Search
|
||||
|
||||
# Finally, get the real link
|
||||
@@ -42,4 +61,4 @@ $Parameters = @{
|
||||
}
|
||||
Invoke-Webrequest @Parameters
|
||||
|
||||
echo "LatestSupportedYT=$LatestSupportedYT" >> $env:GITHUB_ENV
|
||||
echo "LatestSupportedYT=$LatestSupported" >> $env:GITHUB_ENV
|
||||
|
||||
Reference in New Issue
Block a user