Skip to content

Commit

Permalink
automatize versions of zlib and cmake too
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Jul 25, 2024
1 parent 8537efc commit b90c5f7
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions resources/scripts/github-actions/build-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ $git_revision = git rev-parse --short HEAD
$old_pwd = $pwd.Path

# Functions.
function Fetch-Latest-Release([string]$ReleasesUrl, [string]$TargetNamePrefix) {
$releases_req = Invoke-WebRequest -Uri "$ReleasesUrl"
function Fetch-Latest-Release([string]$OrgRepo, [string]$NameRegex) {
$releases_url = "https://api.github.com/repos/" + $OrgRepo +"/releases"
$releases_req = Invoke-WebRequest -Uri "$releases_url"
$releases_json = $releases_req.Content | ConvertFrom-Json
$asset = $releases_json[0].assets | Where-Object {$_.name.StartsWith($TargetNamePrefix)} | Select-Object;
$asset = $releases_json[0].assets | Where-Object {$_.name -match $NameRegex} | Select-Object;

return $asset
}
Expand Down Expand Up @@ -54,22 +55,16 @@ $maria_version = "11.4.2"
$maria_link = "https://archive.mariadb.org/mariadb-$maria_version/winx64-packages/mariadb-$maria_version-winx64.zip"
$maria_output = "maria.zip"

$cmake_version = "3.30.1"
$cmake_link = "https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-windows-x86_64.zip"
$cmake_link = Fetch-Latest-Release -OrgRepo "Kitware/CMake" -NameRegex "cmake-.+-windows-x86_64\.zip" | Select-Object -ExpandProperty browser_download_url
$cmake_output = "cmake.zip"

$zlib_version = "1.3.1"
$zlib_link = "https://github.com/madler/zlib/archive/refs/tags/v$zlib_version.zip"
$zlib_link = Fetch-Latest-Release -OrgRepo "madler/zlib" -NameRegex "zlib.+\.zip$" | Select-Object -ExpandProperty browser_download_url
$zlib_output = "zlib.zip"

$asset_mpv = Fetch-Latest-Release -ReleasesUrl "https://api.github.com/repos/zhongfly/mpv-winbuild/releases" -TargetNamePrefix "mpv-dev-x86_64-2"

$libmpv_link = $asset_mpv.browser_download_url
$libmpv_link = Fetch-Latest-Release -OrgRepo "zhongfly/mpv-winbuild" -NameRegex "mpv-dev-x86_64-2.+7z" | Select-Object -ExpandProperty browser_download_url
$libmpv_output = "mpv.zip"

$asset_ytdlp = Fetch-Latest-Release -ReleasesUrl "https://api.github.com/repos/yt-dlp/yt-dlp/releases" -TargetNamePrefix "yt-dlp.exe"

$ytdlp_link = $asset_ytdlp.browser_download_url
$ytdlp_link = Fetch-Latest-Release -OrgRepo "yt-dlp/yt-dlp" -NameRegex "yt-dlp.exe" | Select-Object -ExpandProperty browser_download_url
$ytdlp_output = "yt-dlp.exe"

Invoke-WebRequest -Uri "$maria_link" -OutFile "$maria_output"
Expand Down

0 comments on commit b90c5f7

Please sign in to comment.