Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2023-01-02 22:45:40 +07:00
parent 7fe821d4ad
commit 28f0c0c22f
5 changed files with 102 additions and 93 deletions

View File

@@ -52,8 +52,8 @@ jobs:
& $JavaPath `
-jar "Temp\revanced-cli.jar" `
--apk "Temp\youtube.apk" `
--bundles "Temp\revanced-patches.jar" `
--merge "Temp\app-release-unsigned.apk" `
--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" `
@@ -76,7 +76,8 @@ jobs:
$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 }}")
# https://trstringer.com/github-actions-multiline-strings/
echo "::set-output name=RELEASE_BODY::$Release"
# echo "::set-output name=RELEASE_BODY::$Release"
echo "RELEASE_BODY=$Release" >> $GITHUB_OUTPUT
$ReleaseName = Get-Date -f "yyyy.MM.dd"
echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV

View File

@@ -9,20 +9,20 @@
* Azul Zulu.
.NOTES
After compiling, microg.apk and compiled revanced.apk will be located in "Downloads folder\ReVanced"
After compiling, microg.apk and compiled revanced.apk will be located in "Script location folder folder\ReVanced"
.LINKS
https://github.com/revanced
#>
#Requires -Version 5.1
# 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
# Download all files to "Downloads folder\ReVanced"
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
if (-not (Test-Path -Path "$DownloadsFolder\ReVanced"))
# Download all files to "Script location folder\ReVanced"
$WorkingFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
if (-not (Test-Path -Path "$WorkingFolder\ReVanced"))
{
New-Item -Path "$DownloadsFolder\ReVanced" -ItemType Directory -Force
New-Item -Path "$WorkingFolder\ReVanced" -ItemType Directory -Force
}
# Get latest supported YouTube client version via ReVanced JSON
@@ -59,7 +59,7 @@ $URL_Part = $URL_Part.Replace("&amp;", "&")
# Finally, get the real link
$Parameters = @{
Uri = "https://www.apkmirror.com$URL_Part"
OutFile = "$DownloadsFolder\ReVanced\youtube.apk"
OutFile = "$WorkingFolder\ReVanced\youtube.apk"
UseBasicParsing = $true
Verbose = $true
}
@@ -75,7 +75,7 @@ $Tag = (Invoke-RestMethod @Parameters).tag_name
$Tag2 = $Tag.replace("v", "")
$Parameters = @{
Uri = "https://github.com/revanced/revanced-cli/releases/download/$Tag/revanced-cli-$Tag2-all.jar"
Outfile = "$DownloadsFolder\ReVanced\revanced-cli.jar"
Outfile = "$WorkingFolder\ReVanced\revanced-cli.jar"
UseBasicParsing = $true
Verbose = $true
}
@@ -91,7 +91,7 @@ $Tag = (Invoke-RestMethod @Parameters).tag_name
$Tag2 = $Tag.replace("v", "")
$Parameters = @{
Uri = "https://github.com/revanced/revanced-patches/releases/download/$Tag/revanced-patches-$Tag2.jar"
Outfile = "$DownloadsFolder\ReVanced\revanced-patches.jar"
Outfile = "$WorkingFolder\ReVanced\revanced-patches.jar"
UseBasicParsing = $true
Verbose = $true
}
@@ -103,10 +103,13 @@ $Parameters = @{
UseBasicParsing = $true
Verbose = $true
}
$Tag = (Invoke-RestMethod @Parameters).tag_name
# $Tag = (Invoke-RestMethod @Parameters).tag_name
# $Tag2 = $Tag.replace("v", "")
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
$Parameters = @{
Uri = "https://github.com/revanced/revanced-integrations/releases/download/$Tag/app-release-unsigned.apk"
Outfile = "$DownloadsFolder\ReVanced\app-release-unsigned.apk"
# Uri = "https://github.com/revanced/revanced-integrations/releases/download/$Tag/revanced-integrations-$Tag2.apk"
Uri = $URL
Outfile = "$WorkingFolder\ReVanced\revanced-integrations.apk"
UseBasicParsing = $true
Verbose = $true
}
@@ -121,7 +124,7 @@ $Parameters = @{
$Tag = (Invoke-RestMethod @Parameters).tag_name
$Parameters = @{
Uri = "https://github.com/TeamVanced/VancedMicroG/releases/download/$Tag/microg.apk"
Outfile = "$DownloadsFolder\ReVanced\microg.apk"
Outfile = "$WorkingFolder\ReVanced\microg.apk"
UseBasicParsing = $true
Verbose = $true
}
@@ -136,7 +139,7 @@ $Parameters = @{
$URL = (Invoke-RestMethod @Parameters).architecture."64bit".url
$Parameters = @{
Uri = $URL
Outfile = "$DownloadsFolder\ReVanced\jdk_windows-x64_bin.zip"
Outfile = "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip"
UseBasicParsing = $true
Verbose = $true
}
@@ -144,26 +147,30 @@ Invoke-RestMethod @Parameters
# Expand jdk_windows-x64_bin archive
$Parameters = @{
Path = "$DownloadsFolder\ReVanced\jdk_windows-x64_bin.zip"
DestinationPath = "$DownloadsFolder\ReVanced\jdk_windows-x64_bin"
Path = "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip"
DestinationPath = "$WorkingFolder\ReVanced\jdk"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
Remove-Item -Path "$DownloadsFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
Remove-Item -Path "$WorkingFolder\ReVanced\jdk_windows-x64_bin.zip" -Force
# https://github.com/revanced/revanced-patches
& "$DownloadsFolder\ReVanced\jdk_windows-x64_bin\zulu*win_x64\bin\java.exe" `
-jar "$DownloadsFolder\ReVanced\revanced-cli.jar" `
--apk "$DownloadsFolder\ReVanced\youtube.apk" `
--bundles "$DownloadsFolder\ReVanced\revanced-patches.jar" `
--merge "$DownloadsFolder\ReVanced\app-release-unsigned.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" `
--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 "$DownloadsFolder\ReVanced\Temp" `
--out "$DownloadsFolder\ReVanced\revanced.apk"
--temp-dir "$WorkingFolder\ReVanced\Temp" `
--out "$WorkingFolder\ReVanced\revanced.apk"
Invoke-Item -Path "$DownloadsFolder\ReVanced"
# Open working directory with builded files
# Invoke-Item -Path "$WorkingFolder\ReVanced"
Write-Warning -Message "Latest available revanced.apk & microg.apk are ready in `"$DownloadsFolder\ReVanced`""
# Remove temp directory, because cli failed to clean up directory
Remove-Item -Path "$WorkingFolder\ReVanced\Temp" -Recurse -Force -Confirm:$false
Write-Warning -Message "Latest available revanced.apk & microg.apk are ready in `"$WorkingFolder\ReVanced`""

View File

@@ -1,4 +1,4 @@
<a href="https://github.com/farag2/ReVanced_Builder/actions"><img src="https://img.shields.io/github/workflow/status/farag2/ReVanced_Builder/Build?label=GitHub%20Actions&logo=GitHub"></a>
<a href="https://github.com/JDM170/ReVanced_Builder/actions"><img src="https://img.shields.io/github/workflow/status/farag2/ReVanced_Builder/Build?label=GitHub%20Actions&logo=GitHub"></a>
# ReVanced builder
@@ -6,7 +6,7 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
## Usage
* To build `revanced.apk` locally you need just to run [`Build.ps1`](https://github.com/farag2/ReVanced_Builder/blob/main/Build.ps1) via PowerShell;
* 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
@@ -14,17 +14,16 @@ Build ReVanced package (.apk) easily than ever using latest ReVanced patches and
* premium-heading
* tablet-mini-player
* 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 appseverything will be held in your `Downloads folder\ReVanced`;
* Script installs no appseverything will be held in your `Script location folder\ReVanced`;
* After compiling you get `revanced.apk` & `microg.apk` ready to be installed;
* Release notes are generated dynamically using the [Release.md](https://github.com/far…r/blob/main/Release.md) template.
## By using CI/CD
```powershell
git clone https://github.com/farag2/ReVanced_Builder
git clone https://github.com/JDM170/ReVanced_Builder
```
Trigger the [`Build`](https://github.com/farag2/ReVanced_Builder/actions/workflows/Build.yml) Action manually to create [release page](https://github.com/farag2/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.
![image](https://user-images.githubusercontent.com/10544660/187949763-82fd7a07-8e4e-4527-b631-11920077141f.png)
@@ -35,7 +34,7 @@ Trigger the [`Build`](https://github.com/farag2/ReVanced_Builder/actions/workflo
* Windows 10 x64 or Windows 11
* Windows PowerShell 5.1
* PowerShell 7 won't work due to it doesn't contain Trident HTML parser, so I have to use a 3rd party parser [AngleSharp](https://github.com/AngleSharp/AngleSharp);
* If you still want it, [get](https://github.com/farag2/ReVanced_Builder/blob/de0b988f3be738bfd6ea4bad3b3be91aee20aceb/.github/workflows/Build.yml#L23) code from Actions (it's run in PowerShell 7).
* If you still want it, [get](https://github.com/JDM170/ReVanced_Builder/blob/main/.github/workflows/Build.yml) code from Actions (it's run in PowerShell 7).
## Links

View File

@@ -4,10 +4,13 @@ $Parameters = @{
UseBasicParsing = $true
Verbose = $true
}
$IntegrationsTag = (Invoke-RestMethod @Parameters).tag_name
# $Tag = (Invoke-RestMethod @Parameters).tag_name
# $Tag2 = $Tag.replace("v", "")
$URL = (Invoke-RestMethod @Parameters).assets.browser_download_url
$Parameters = @{
Uri = "https://github.com/revanced/revanced-integrations/releases/download/$IntegrationsTag/app-release-unsigned.apk"
Outfile = "Temp\app-release-unsigned.apk"
# Uri = "https://github.com/revanced/revanced-integrations/releases/download/$Tag/revanced-integrations-$Tag2.apk"
Uri = $URL
Outfile = "Temp\revanced-integrations.apk"
UseBasicParsing = $true
Verbose = $true
}

View File

@@ -1,4 +1,3 @@
# https://github.com/revanced/revanced-patches
$Parameters = @{
Uri = "https://api.github.com/repos/revanced/revanced-patches/releases/latest"