Last active
December 12, 2024 18:43
-
-
Save alimbada/fe6a3052632677ed00cef80b7d43b6ae to your computer and use it in GitHub Desktop.
Download and install the latest release of an app from a GitHub repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/bash | |
repo=$1 | |
release=$(curl -s https://api.github.com/repos/$repo/releases/latest | jq '.assets[] | select(.name | endswith("aarch64.dmg"))') | |
outfile=~/Downloads/$(jq -r .name <<<$release) | |
curl -L $(jq -r .browser_download_url <<<$release) --output $outfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$repo = $args[0]; | |
$outdir = $args[1] | |
$release = (curl -s https://api.github.com/repos/scito/extract_otp_secrets/releases/latest | ConvertFrom-Json).assets | where { $_.name -like "*.msi" -or $_.name -like "*.exe" } | |
# TODO: check there's only one item | |
$outFile = "$outdir\$($release.name)"; | |
curl -L $release.browser_download_url --output $outFile; | |
& $outFile |
Requires PowerShell 7+ as the curl
command in previous PS versions is an alias of Invoke-WebRequest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For apps that are unavailable via WinGet or Chocolatey, this script can be used to download and install the latest version of an app when it notifies you that there's an update available.
Replace value of
$repo
with any repo which contains Windows Installer releases, e.g.$repo = "JPersson77/LGTVCompanion"