mirror of https://github.com/aminya/setup-cpp
fix: filter 7z in mingw asset list
This commit is contained in:
parent
3e4a96d3c7
commit
6e3b572a56
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,12 @@ import { saveGitHubAssetList } from "../utils/github/fetch-assets.ts"
|
|||
*/
|
||||
async function main() {
|
||||
// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
await saveGitHubAssetList("brechtsanders", "winlibs_mingw", "./src/gcc/github_brechtsanders_winlibs_mingw.json")
|
||||
await saveGitHubAssetList(
|
||||
"brechtsanders",
|
||||
"winlibs_mingw",
|
||||
"./src/gcc/github_brechtsanders_winlibs_mingw.json",
|
||||
(asset) => asset.endsWith(".7z"),
|
||||
)
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
|
|
|
@ -41,7 +41,6 @@ async function getGccPackageInfo(version: string, platform: NodeJS.Platform, arc
|
|||
: arch === "ia32"
|
||||
? "i386"
|
||||
: arch,
|
||||
filterName: (name) => name.endsWith(".7z"),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,12 @@ import type { Assets } from "./load-assets.ts"
|
|||
* @param prerelease Whether to include prereleases
|
||||
*/
|
||||
|
||||
async function fetchGitHubAssetList(owner: string, repo: string, prerelease = false) {
|
||||
async function fetchGitHubAssetList(
|
||||
owner: string,
|
||||
repo: string,
|
||||
filterAssets?: (asset: string) => boolean,
|
||||
prerelease = false,
|
||||
) {
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_TOKEN,
|
||||
})
|
||||
|
@ -47,7 +52,11 @@ async function fetchGitHubAssetList(owner: string, repo: string, prerelease = fa
|
|||
}
|
||||
|
||||
const assets_ref = assets[release.tag_name]
|
||||
|
||||
for (const asset of release.assets) {
|
||||
if (filterAssets !== undefined && !filterAssets(asset.name)) {
|
||||
continue
|
||||
}
|
||||
assets_ref.push(asset.name)
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +76,9 @@ export async function saveGitHubAssetList(
|
|||
owner: string,
|
||||
repo: string,
|
||||
path: string,
|
||||
filterAssets?: (asset: string) => boolean,
|
||||
) {
|
||||
const assets = await fetchGitHubAssetList(owner, repo)
|
||||
const assets = await fetchGitHubAssetList(owner, repo, filterAssets, false)
|
||||
|
||||
const jsonStringify = JsonStringify.configure({
|
||||
deterministic: compareVersion,
|
||||
|
|
Loading…
Reference in New Issue