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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires PowerShell 7+ as the
curl
command in previous PS versions is an alias ofInvoke-WebRequest