From c9ca27f2b7ed11d3cb4ede471f232a7caa98f4cf Mon Sep 17 00:00:00 2001 From: Lev Rusanov <30170278+JDM170@users.noreply.github.com> Date: Sun, 18 May 2025 23:18:19 +0700 Subject: [PATCH] Upload files Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com> --- .github/workflows/Build.yml | 80 ++++++++++++ Build.ps1 | 236 +++++++++++++++++++++++++++++++++++ LICENSE | 21 ++++ README.md | 45 +++++++ ReleaseNotesTemplate.md | 7 ++ Scripts/MicroG.ps1 | 24 ++++ Scripts/ReVanced_CLI.ps1 | 18 +++ Scripts/ReVanced_Patches.ps1 | 18 +++ Scripts/YouTube.ps1 | 86 +++++++++++++ Scripts/Zulu_JDK.ps1 | 30 +++++ 10 files changed, 565 insertions(+) create mode 100644 .github/workflows/Build.yml create mode 100644 Build.ps1 create mode 100644 LICENSE create mode 100644 README.md create mode 100644 ReleaseNotesTemplate.md create mode 100644 Scripts/MicroG.ps1 create mode 100644 Scripts/ReVanced_CLI.ps1 create mode 100644 Scripts/ReVanced_Patches.ps1 create mode 100644 Scripts/YouTube.ps1 create mode 100644 Scripts/Zulu_JDK.ps1 diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 0000000..45d90d8 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,80 @@ +name: Build + +on: + workflow_dispatch: + +jobs: + patch: + runs-on: windows-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@main + + - name: Install AngleSharp + run: | + Install-Package AngleSharp -Source https://www.nuget.org/api/v2 -SkipDependencies -Force + + - name: Download YouTube + run: | + New-Item -Path Temp -ItemType Directory -Force + + . Scripts\YouTube.ps1 + + - name: Download ReVanced CLI + run: | + . Scripts\ReVanced_CLI.ps1 + + - name: Download ReVanced Patches + run: | + . Scripts\ReVanced_Patches.ps1 + + - name: Download Vanced MicroG + run: | + . Scripts\MicroG.ps1 + + - name: Download and expanding Zulu JDK + run: | + . Scripts\Zulu_JDK.ps1 + + - 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" patch ` + --patches "Temp\revanced-patches.rvp" ` + --disable "Always repeat" ` + --disable "Disable auto captions" ` + --disable "Hide timestamp" ` + --disable "Hide seekbar" ` + --purge ` + --out "Temp\revanced.apk" ` + "Temp\youtube.apk" + + - name: Create archive + run: | + Get-ChildItem Temp\Temp -Recurse -Force + $Parameters = @{ + Path = "Temp\revanced.apk", "Temp\microg.apk", "Temp\microg-hw.apk" + DestinationPath = "ReVanced.zip" + CompressionLevel = "Fastest" + Force = $true + } + Compress-Archive @Parameters + + - name: Create Release Notes + id: read_release + run: | + # https://en.wikipedia.org/wiki/Percent-encoding + (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("YouTubeTag", "${{ env.LatestSupportedYT }}").replace("CLITag", "${{ env.CLIvtag }}").replace("PatchesTag", "${{ env.Patchesvtag }}").replace("MicroGTag", "${{ env.MicroGTag }}").replace("ZuluTag", "${{ env.ZuluTag }}") | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force + # https://trstringer.com/github-actions-multiline-strings/ + 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: Upload to Releases + uses: softprops/action-gh-release@v2.2.1 + with: + tag_name: ${{ env.RELEASE_NAME }} + body_path: ${{ steps.read_release.outputs.ReleaseBody }} + files: ReVanced.zip diff --git a/Build.ps1 b/Build.ps1 new file mode 100644 index 0000000..5940f9a --- /dev/null +++ b/Build.ps1 @@ -0,0 +1,236 @@ +<# + .SYNOPSIS + Build ReVanced app using latest components: + * YouTube (latest supported); + * ReVanced CLI; + * ReVanced Patches; + * ReVanced Integrations; + * ReVanced microG GmsCore; + * Azul Zulu. + + .NOTES + 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 +# 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 + +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +if ($Host.Version.Major -eq 5) +{ + # Progress bar can significantly impact cmdlet performance + # https://github.com/PowerShell/PowerShell/issues/2138 + $Script:ProgressPreference = "SilentlyContinue" +} + +# Download all files to "Script location folder\ReVanced" +$CurrentFolder = Split-Path $MyInvocation.MyCommand.Path -Parent +if (-not (Test-Path -Path "$CurrentFolder\ReVanced")) +{ + New-Item -Path "$CurrentFolder\ReVanced" -ItemType Directory -Force +} + +# Get the latest supported YouTube version to patch +# https://api.revanced.app +$Parameters = @{ + Uri = "https://api.revanced.app/v4/patches/list" + UseBasicParsing = $true +} +$JSON = (Invoke-Webrequest @Parameters).Content | ConvertFrom-Json +$versions = ($JSON | Where-Object -FilterScript {$_.name -eq "Video ads"}) +$LatestSupported = $versions.compatiblePackages.'com.google.android.youtube' | Sort-Object -Descending -Unique | Select-Object -First 1 + +Write-Verbose -Message "" -Verbose +Write-Verbose -Message "Downloading the latest supported YouTube apk" -Verbose + +# We need a NON-bundle version +<# +# https://apkpure.net/ru/youtube/com.google.android.youtube/versions +$Parameters = @{ + Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)" + UseBasicParsing = $true + Verbose = $true +} +$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1 + +$Parameters = @{ + Uri = $URL + OutFile = "$CurrentFolder\ReVanced\youtube.apk" + UseBasicParsing = $true + Verbose = $true +} +Invoke-Webrequest @Parameters +#> + +# https://www.apkmirror.com/apk/google-inc/youtube/ +$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported.replace('.', '-'))-release/" +$Parameters = @{ + Uri = $apkMirrorLink + UseBasicParsing = $false # Disabled + Verbose = $true +} +$Request = Invoke-Webrequest @Parameters +$Request.ParsedHtml.getElementsByClassName("table-row headerFont") | ForEach-Object -Process { + foreach ($child in $_.children) + { + if ($child.innerText -eq "nodpi") + { + $apkPackageLink = ($_.getElementsByTagName("a") | Select-Object -First 1).nameProp + break + } + } +} +$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE) + +# Get unique key to generate direct link +$Parameters = @{ + Uri = $apkMirrorLink + UseBasicParsing = $false # Disabled + Verbose = $true +} +$Request = Invoke-Webrequest @Parameters +$nameProp = $Request.ParsedHtml.getElementsByClassName("accent_bg btn btn-flat downloadButton") | ForEach-Object -Process {$_.nameProp} + +$Parameters = @{ + Uri = $apkMirrorLink + "/download/$($nameProp)" + UseBasicParsing = $false # Disabled + Verbose = $true +} +$URL_Part = ((Invoke-Webrequest @Parameters).Links | Where-Object -FilterScript {$_.innerHTML -eq "here"}).href +# Replace "&" with "&" to make it work +$URL_Part = $URL_Part.Replace("&", "&") + +# Finally, get the real link +$Parameters = @{ + Uri = "https://www.apkmirror.com$URL_Part" + OutFile = "$CurrentFolder\ReVanced\youtube.apk" + UseBasicParsing = $true + Verbose = $true +} +Invoke-Webrequest @Parameters + +Write-Verbose -Message "" -Verbose +Write-Verbose -Message "Downloading ReVanced CLI" -Verbose +# https://github.com/revanced/revanced-cli +$Parameters = @{ + Uri = "https://api.github.com/repos/revanced/revanced-cli/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "application/java-archive"}).browser_download_url +$Parameters = @{ + Uri = $URL + Outfile = "$CurrentFolder\ReVanced\revanced-cli.jar" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +Write-Verbose -Message "" -Verbose +Write-Verbose -Message "Downloading ReVanced patches" -Verbose +# https://github.com/revanced/revanced-patches +$Parameters = @{ + Uri = "https://api.github.com/repos/revanced/revanced-patches/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$URL = ((Invoke-RestMethod @Parameters).assets | Where-Object -FilterScript {$_.content_type -eq "text/plain"}).browser_download_url +$Parameters = @{ + Uri = $URL + Outfile = "$CurrentFolder\ReVanced\revanced-patches.rvp" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +Write-Verbose -Message "" -Verbose +Write-Verbose -Message "Downloading ReVanced GmsCore" -Verbose +# https://github.com/ReVanced/GmsCore +$Parameters = @{ + Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$URL = (Invoke-RestMethod @Parameters).assets +foreach($url in $URL) { + if ($url.name.Contains("-hw-")) { + $url.name = "microg-hw.apk" + } else { + $url.name = "microg.apk" + } + $Parameters = @{ + Uri = $url.browser_download_url + Outfile = "$CurrentFolder\ReVanced\$($url.name)" + UseBasicParsing = $true + Verbose = $true + } + Invoke-RestMethod @Parameters +} + +# Sometimes older version of zulu-jdk causes conflict, so remove older version before proceeding. +if (Test-Path -Path "$CurrentFolder\ReVanced\jdk") +{ + Remove-Item -Path "$CurrentFolder\ReVanced\jdk" -Recurse -Force +} + +Write-Verbose -Message "" -Verbose +Write-Verbose -Message "Downloading Azul Zulu" -Verbose +# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json +$Parameters = @{ + Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json" + UseBasicParsing = $true + Verbose = $true +} +$URL = (Invoke-RestMethod @Parameters).architecture."64bit".url +$Parameters = @{ + Uri = $URL + Outfile = "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +# Expand jdk_windows-x64_bin archive +$Parameters = @{ + Path = "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip" + DestinationPath = "$CurrentFolder\ReVanced\jdk" + Force = $true + Verbose = $true +} +Expand-Archive @Parameters + +Remove-Item -Path "$CurrentFolder\ReVanced\jdk_windows-x64_bin.zip" -Force + +# Let's create patched APK +& "$CurrentFolder\ReVanced\jdk\zulu*win_x64\bin\java.exe" ` +-jar "$CurrentFolder\ReVanced\revanced-cli.jar" patch ` +--patches "$CurrentFolder\ReVanced\revanced-patches.rvp" ` +--disable "Always repeat" ` +--disable "Disable auto captions" ` +--disable "Hide timestamp" ` +--disable "Hide seekbar" ` +--purge ` +--temporary-files-path "$CurrentFolder\ReVanced\Temp" ` +--out "$CurrentFolder\ReVanced\revanced.apk" ` +"$CurrentFolder\ReVanced\youtube.apk" + +# Open working directory with builded files +# Invoke-Item -Path "$CurrentFolder\ReVanced" + +# Remove temp directory, because cli failed to clean up directory +# Remove-Item -Path "$CurrentFolder\ReVanced\Temp" -Recurse -Force -Confirm:$false + +$Files = @( + "$CurrentFolder\ReVanced\Temp", + "$CurrentFolder\ReVanced\jdk", + "$CurrentFolder\ReVanced\revanced-cli.jar", + "$CurrentFolder\ReVanced\revanced-patches.rvp", + "$CurrentFolder\ReVanced\youtube.apk" +) +Remove-Item -Path $Files -Recurse -Force + +Write-Warning -Message "Latest available revanced.apk & microg.apk are ready in `"$CurrentFolder\ReVanced`"" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d473246 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Dmitry Nefedov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..273f6f3 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ + + +# ReVanced builder + +Build ReVanced package (.apk) easily than ever using latest ReVanced patches and dependencies locally or via cloud + +## Usage + +### Locally + +* 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://revanced.app/patches?pkg=com.google.android.youtube) except the followings applied to `revanced.apk`: + * always-autorepeat + * hide-captions-button + * hide-timestamp + * hide-seekbar +* The script downloads latest available YouTube package (having parsed [ReVanced API](https://api.revanced.app/v4/patches/list)) supported by ReVanced Team from [APKMirror](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; +* Release notes are generated dynamically using the [ReleaseNotesTemplate.md](https://github.com/JDM170/ReVanced_Builder/blob/main/ReleaseNotesTemplate.md) template. + +### By using CI/CD + +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) + +`ReVanced.zip` will contain a built `revanced.apk` & latest `microg.apk`. + +## Requirements if you compile locally + +* Windows 10 x64 or Windows 11 +* Windows PowerShell 5.1 + * if you want to use PowerShell 7, you will have to install a 3rd party HTML parser ([AngleSharp](https://github.com/AngleSharp/AngleSharp)) + +## Links + +* [APKPure](https://apkpure.net) +* [APKMirror](https://apkmirror.com) +* [ReVanced CLI](https://github.com/revanced/revanced-cli) +* [ReVanced Patches](https://github.com/revanced/revanced-patches) +* [ReVanced MicroG](https://github.com/ReVanced/GmsCore) +* [AngleSharp](https://github.com/AngleSharp/AngleSharp) +* [Zulu JDK](https://github.com/ScoopInstaller/Java) +* [Sophia Telegram chat](https://t.me/sophia_chat) diff --git a/ReleaseNotesTemplate.md b/ReleaseNotesTemplate.md new file mode 100644 index 0000000..2ba2829 --- /dev/null +++ b/ReleaseNotesTemplate.md @@ -0,0 +1,7 @@ +## Automatically generated release notes + +* YouTube YouTubeTag; +* ReVanced CLI CLITag; +* ReVanced Patches PatchesTag; +* ReVanced MicroG MicroGTag; +* Azul Zulu ZuluTag. diff --git a/Scripts/MicroG.ps1 b/Scripts/MicroG.ps1 new file mode 100644 index 0000000..eefbf31 --- /dev/null +++ b/Scripts/MicroG.ps1 @@ -0,0 +1,24 @@ +# https://github.com/ReVanced/GmsCore +$Parameters = @{ + Uri = "https://api.github.com/repos/ReVanced/GmsCore/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$apiResult = Invoke-RestMethod @Parameters +$TAG = $apiResult.tag_name +foreach($url in $apiResult.assets) { + if ($url.name.Contains("-hw-")) { + $url.name = "microg-hw.apk" + } else { + $url.name = "microg.apk" + } + $Parameters = @{ + Uri = $url.browser_download_url + Outfile = "Temp\$($url.name)" + UseBasicParsing = $true + Verbose = $true + } + Invoke-RestMethod @Parameters +} + +echo "MicroGTag=$TAG" >> $env:GITHUB_ENV diff --git a/Scripts/ReVanced_CLI.ps1 b/Scripts/ReVanced_CLI.ps1 new file mode 100644 index 0000000..cf0d146 --- /dev/null +++ b/Scripts/ReVanced_CLI.ps1 @@ -0,0 +1,18 @@ +# https://github.com/revanced/revanced-cli +$Parameters = @{ + Uri = "https://api.github.com/repos/revanced/revanced-cli/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$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 = $URL + Outfile = "Temp\revanced-cli.jar" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +echo "CLIvtag=$TAG" >> $env:GITHUB_ENV diff --git a/Scripts/ReVanced_Patches.ps1 b/Scripts/ReVanced_Patches.ps1 new file mode 100644 index 0000000..0f41bd8 --- /dev/null +++ b/Scripts/ReVanced_Patches.ps1 @@ -0,0 +1,18 @@ +# https://github.com/revanced/revanced-patches +$Parameters = @{ + Uri = "https://api.github.com/repos/revanced/revanced-patches/releases/latest" + UseBasicParsing = $true + Verbose = $true +} +$apiResult = Invoke-RestMethod @Parameters +$URL = ($apiResult.assets | Where-Object -FilterScript {$_.content_type -eq "text/plain"}).browser_download_url +$TAG = $apiResult.tag_name +$Parameters = @{ + Uri = $URL + Outfile = "Temp\revanced-patches.rvp" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +echo "Patchesvtag=$TAG" >> $env:GITHUB_ENV diff --git a/Scripts/YouTube.ps1 b/Scripts/YouTube.ps1 new file mode 100644 index 0000000..420e369 --- /dev/null +++ b/Scripts/YouTube.ps1 @@ -0,0 +1,86 @@ +# Get the latest supported YouTube version to patch +# https://api.revanced.app/docs/swagger +$Parameters = @{ + Uri = "https://api.revanced.app/v4/patches/list" + UseBasicParsing = $true +} +$JSON = (Invoke-Webrequest @Parameters).Content | ConvertFrom-Json +$versions = ($JSON | Where-Object -FilterScript {$_.name -eq "Video ads"}) +$LatestSupported = $versions.compatiblePackages.'com.google.android.youtube' | Sort-Object -Descending -Unique | Select-Object -First 1 + +# We need a NON-bundle version +# https://apkpure.net/ru/youtube/com.google.android.youtube/versions +<# +$Parameters = @{ + Uri = "https://apkpure.net/youtube/com.google.android.youtube/download/$($LatestSupported)" + UseBasicParsing = $true + Verbose = $true +} +$URL = (Invoke-Webrequest @Parameters).Links.href | Where-Object -FilterScript {$_ -match "APK/com.google.android.youtube"} | Select-Object -Index 1 + +$Parameters = @{ + Uri = $URL + OutFile = "Temp\youtube.apk" + UseBasicParsing = $true + Verbose = $true +} +Invoke-Webrequest @Parameters +#> + +$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 + +# Create parser object +$angleparser = New-Object -TypeName AngleSharp.Html.Parser.HtmlParser + +# Trying to find correct APK link (not BUNDLE) +# https://www.apkmirror.com/apk/google-inc/youtube/ +$apkMirrorLink = "https://www.apkmirror.com/apk/google-inc/youtube/youtube-$($LatestSupported.replace('.', '-'))-release/" +$Parameters = @{ + Uri = $apkMirrorLink + UseBasicParsing = $false # Disabled + Verbose = $true +} +$Request = Invoke-Webrequest @Parameters +$Parsed = $angleparser.ParseDocument($Request.Content) +$Parsed.All | Where-Object -FilterScript {$_.ClassName -match "table-row headerFont"} | ForEach-Object -Process { + foreach($child in $_.children) + { + if ($child.InnerHtml -eq "nodpi") + { + $apkPackageLink = (($_.getElementsByTagName("a") | Select-Object -First 1).Href).Substring(57) + break + } + } +} +$apkMirrorLink += $apkPackageLink # actual APK link (not BUNDLE) + +# Get unique key to generate direct link +$Parameters = @{ + Uri = $apkMirrorLink + UseBasicParsing = $false # Disabled + Verbose = $true +} +$Request = Invoke-Webrequest @Parameters +$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 = $apkMirrorLink + "download/$($Key)" + UseBasicParsing = $true + Verbose = $true +} +$Request = Invoke-Webrequest @Parameters +$Parsed = $angleparser.ParseDocument($Request.Content) +$Key = ($Parsed.All | Where-Object -FilterScript { $_.InnerHtml -eq "here" }).Search + +# Finally, get the real link +$Parameters = @{ + Uri = "https://www.apkmirror.com/wp-content/themes/APKMirror/download.php$Key" + OutFile = "Temp\youtube.apk" + UseBasicParsing = $true + Verbose = $true +} +Invoke-Webrequest @Parameters + +echo "LatestSupportedYT=$LatestSupported" >> $env:GITHUB_ENV diff --git a/Scripts/Zulu_JDK.ps1 b/Scripts/Zulu_JDK.ps1 new file mode 100644 index 0000000..838f859 --- /dev/null +++ b/Scripts/Zulu_JDK.ps1 @@ -0,0 +1,30 @@ +# https://github.com/ScoopInstaller/Java/blob/master/bucket/zulu-jdk.json +$Parameters = @{ + Uri = "https://raw.githubusercontent.com/ScoopInstaller/Java/master/bucket/zulu-jdk.json" + UseBasicParsing = $true + Verbose = $true +} +$apiResult = Invoke-RestMethod @Parameters +$URL = $apiResult.architecture."64bit".url +$TAG = $apiResult.version +$Parameters = @{ + Uri = $URL + Outfile = "Temp\jdk_windows-x64_bin.zip" + UseBasicParsing = $true + Verbose = $true +} +Invoke-RestMethod @Parameters + +echo "ZuluTag=$TAG" >> $env:GITHUB_ENV + +Write-Verbose -Message "Expanding Zulu JDK" -Verbose + +$Parameters = @{ + Path = "Temp\jdk_windows-x64_bin.zip" + DestinationPath = "Temp\jdk_windows-x64_bin" + Force = $true + Verbose = $true +} +Expand-Archive @Parameters + +Remove-Item -Path "Temp\jdk_windows-x64_bin.zip" -Force