@opentermsarchive/engine 10.3.2 → 10.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ export default async function publish({ archivePath, releaseDate, stats }) {
|
|
|
30
30
|
logger.info('Uploading release asset…');
|
|
31
31
|
|
|
32
32
|
await octokit.rest.repos.uploadReleaseAsset({
|
|
33
|
-
data: fsApi.
|
|
33
|
+
data: fsApi.createReadStream(archivePath),
|
|
34
34
|
headers: {
|
|
35
35
|
'content-type': 'application/zip',
|
|
36
36
|
'content-length': fsApi.statSync(archivePath).size,
|
|
@@ -22,26 +22,29 @@ export default async function publishRelease({ archivePath, releaseDate, stats }
|
|
|
22
22
|
throw new Error('No publishing platform configured. Please configure at least one of: GitHub (OTA_ENGINE_GITHUB_TOKEN), GitLab (OTA_ENGINE_GITLAB_TOKEN), or data.gouv.fr (OTA_ENGINE_DATAGOUV_API_KEY + datasetId or organizationIdOrSlug in config).');
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const succeeded = [];
|
|
26
|
+
const failed = [];
|
|
27
|
+
|
|
28
|
+
// Execute publications sequentially to avoid memory issues with large file uploads
|
|
29
|
+
for (const platform of platforms) {
|
|
30
|
+
try {
|
|
31
|
+
const url = await platform.publish();
|
|
32
|
+
|
|
33
|
+
succeeded.push({ platform: platform.name, url });
|
|
34
|
+
} catch (error) {
|
|
35
|
+
failed.push({ platform: platform.name, error });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
if (failed.length) {
|
|
35
40
|
let errorMessage = !succeeded.length ? 'All platforms failed to publish:' : 'Some platforms failed to publish:';
|
|
36
41
|
|
|
37
|
-
failed.forEach(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
errorMessage += `\n - ${platforms[index].name}: ${rejectedResult.reason.message}`;
|
|
42
|
+
failed.forEach(({ platform, error }) => {
|
|
43
|
+
errorMessage += `\n - ${platform}: ${error.message}`;
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
logger.error(errorMessage);
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
return succeeded
|
|
49
|
+
return succeeded;
|
|
47
50
|
}
|