Skip to content

Commit

Permalink
Add build result parsing to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed Sep 17, 2024
1 parent 7eab90f commit 3fd5893
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions ci/build-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ for (const buildResult of buildResults) {
.insert([
{
name: buildResult.pkg.name,
version: buildResult.pkg.version,
api_version: buildResult.apiVersion,
short_description: buildResult.pkg.kunkun.shortDescription,
long_description: buildResult.pkg.kunkun.longDescription,
identifier: buildResult.pkg.kunkun.identifier,
Expand Down Expand Up @@ -158,6 +160,8 @@ for (const buildResult of buildResults) {
.from("extensions")
.update({
name: buildResult.pkg.kunkun.name,
version: buildResult.pkg.version,
api_version: buildResult.apiVersion,
short_description: buildResult.pkg.kunkun.shortDescription,
long_description: buildResult.pkg.kunkun.longDescription,
icon: iconClone,
Expand Down
22 changes: 12 additions & 10 deletions ci/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,16 @@ export function buildWithDocker(extPath: string): Promise<{
})
}

export type BuildResult = {
shasum: string
tarballFilename: string
tarballPath: string
extPath: string
pkg: ExtPackageJson
apiVersion: string
}
export const BuildResult = v.object({
shasum: v.string(),
tarballFilename: v.string(),
tarballPath: v.string(),
extPath: v.string(),
pkg: ExtPackageJson,
apiVersion: v.string()
})

export type BuildResult = v.InferOutput<typeof BuildResult>

/**
* Use this function to build an extension with docker and validate the tarball
Expand All @@ -238,14 +240,14 @@ export function buildWithDockerAndValidate(extPath: string): Promise<BuildResult
} else {
console.log("Shasum matches")
}
return {
return v.parse(BuildResult, {
shasum: computedShasum,
tarballFilename: res.stderrTarballFilename,
tarballPath: parsedTarballPath,
extPath: extPath,
pkg: res.pkg,
apiVersion: res.apiVersion
}
})
})
})
.catch((err) => {
Expand Down
3 changes: 2 additions & 1 deletion extensions/disable-apple-quarantine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
"files": [
"./dist",
".gitignore"
]
],
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
}
5 changes: 3 additions & 2 deletions extensions/letterboxd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
"files": [
"./dist",
".gitignore"
]
}
],
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
}
3 changes: 2 additions & 1 deletion extensions/system-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@
"files": [
"./dist",
".gitignore"
]
],
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
}

0 comments on commit 3fd5893

Please sign in to comment.