import getReleaseURL from "https://deno.land/x/get_release_url@1.0.0/mod.ts"
const urls = await getReleaseURL({
provider: "github",
user: "phhusson",
repo: "treble_experimentations",
part: "arm64-ab-gapps",
})
for (const url of urls) {
console.log(url)
}
Default supported providers are GitHub and BitBucket. You can add custom provider functions using addProviderMethod
(PRs for more defaults are welcome!)
import getReleaseURL, {
addProviderMethod,
} from "https://deno.land/x/get_release_url@1.0.0/mod.ts"
const customGithubProvider = async (
{ user, repo, part = "" }: { user: string; repo: string; part?: string },
) => {
const response = await fetch(
`https://api.github.com/repos/${user}/${repo}/releases/latest`,
)
const json = await response.json()
if (json.message === "Not Found") throw new Error("Invalid repository")
if (!("assets" in json)) throw new Error("Rate limit exceeded")
let browser_download_urls: string[] = json.assets.map((
asset: { browser_download_url: string },
) => asset.browser_download_url)
return browser_download_urls.filter((url) => url.includes(part))
}
addProviderMethod("github", customGithubProvider)
await getReleaseURL({
provider: "github",
user: "phhusson",
repo: "treble_experimentations",
part: "arm64-ab-gapps",
}) // Uses custom method
deno run --allow-net https://deno.land/x/get_release_url@1.0.0/get-release-url.ts github phhusson treble_experimentations arm64-aonly
deno install --allow-net https://deno.land/x/get_release_url@1.0.0/get-release-url.ts
get-release github phhusson treble_experimentations arm64-aonly
Usage: get-release (github|bitbucket) user repo [partofreleasefile]
Ex: get-release github phhusson treble_experimentations
get-release github phhusson treble_experimentations arm64-ab-gapps
get-release bitbucket JesusFreke smali
get-release bitbucket JesusFreke smali baksmali