MCPcopy
hub / github.com/openupm/openupm / buildPackage

Function buildPackage

app/jobs/buildPackage.js:22–76  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

20
21// Build package with given name.
22const buildPackage = async function (name) {
23 // Load package yaml file.
24 logger.debug({ pkg: name }, "load yaml file");
25 let pkg = await loadPackage(name);
26 logger.debug({ pkg: name, gitTagIgnore: pkg.gitTagIgnore, gitTagPrefix: pkg.gitTagPrefix, minVersion: pkg.minVersion }, "print pkg meta");
27 // Get remote tags.
28 logger.debug({ pkg: name }, "gitListRemoteTags start");
29 let remoteTags = [];
30 try {
31 remoteTags = await gitListRemoteTags(cleanRepoUrl(pkg.repoUrl, "git"));
32 logger.debug({ pkg: name, remoteTags }, "gitListRemoteTags result");
33 await PackageExtra.setRepoUnavailable(name, false);
34 } catch (error) {
35 // If repository GitHub changes RSA ssh host key
36 if (error.message.includes("Host key verification failed")) {
37 logger.error({ pkg: name }, "GitHub RSA ssh host key verification error");
38 await PackageExtra.setRepoUnavailable(name, true);
39 throw error;
40 }
41 // If repository has became private or been removed...
42 else if (error.message.includes("ERROR: Repository not found") ||
43 error.message.includes("fatal: Could not read from remote repository")) {
44 await PackageExtra.setRepoUnavailable(name, true);
45 return;
46 }
47 throw error;
48 }
49 let validTags = filterRemoteTags({
50 remoteTags,
51 gitTagIgnore: pkg.gitTagIgnore,
52 gitTagPrefix: pkg.gitTagPrefix,
53 minVersion: (pkg.minVersion || "").trim()
54 });
55 validTags.reverse();
56 logger.debug({ validTags }, "validTags");
57 let invalidTags = getInvalidTags({
58 remoteTags,
59 validTags,
60 gitTagIgnore: pkg.gitTagIgnore,
61 gitTagPrefix: pkg.gitTagPrefix,
62 minVersion: (pkg.minVersion || "").trim()
63 });
64 logger.debug({ invalidTags }, "invalidTags");
65 await PackageExtra.setInvalidTags(name, invalidTags);
66 if (!validTags.length) {
67 logger.info({ pkg: name }, "no valid tags found");
68 return;
69 }
70 // Update release records.
71 logger.debug({ pkg: name }, "update release records");
72 let releases = await updateReleaseRecords(pkg.name, validTags);
73 // Add necessary build release jobs.
74 logger.debug({ pkg: name }, "add release jobs");
75 await addReleaseJobs(releases);
76};
77
78// Filter remote tags for non-semver, duplication, ignoration, and minVersion.
79const filterRemoteTags = function ({

Callers 1

processJobFunction · 0.85

Calls 7

loadPackageFunction · 0.85
gitListRemoteTagsFunction · 0.85
cleanRepoUrlFunction · 0.85
filterRemoteTagsFunction · 0.85
updateReleaseRecordsFunction · 0.85
addReleaseJobsFunction · 0.85
getInvalidTagsFunction · 0.70

Tested by

no test coverage detected