From 31a5ee20df11daf69fffe63b657f4f3ef2ed5734 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 17 Sep 2024 09:35:39 +0100 Subject: [PATCH] Tools: Trying to fix autoupdate CI script --- packages/app-desktop/.gitignore | 1 + packages/app-desktop/tools/modifyReleaseAssets.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/app-desktop/.gitignore b/packages/app-desktop/.gitignore index 8cbcf9210e..0bee3f3422 100644 --- a/packages/app-desktop/.gitignore +++ b/packages/app-desktop/.gitignore @@ -24,3 +24,4 @@ build/defaultPlugins/ build/7zip/7za build/7zip/7za.exe sentry.properties +downloads/ diff --git a/packages/app-desktop/tools/modifyReleaseAssets.ts b/packages/app-desktop/tools/modifyReleaseAssets.ts index 35d3b05b97..267b43080c 100644 --- a/packages/app-desktop/tools/modifyReleaseAssets.ts +++ b/packages/app-desktop/tools/modifyReleaseAssets.ts @@ -32,9 +32,11 @@ const renameReleaseAssets = async (context: Context, release: GitHubRelease) => // Creates release assets in Joplin Desktop releases const createReleaseAssets = async (context: Context, release: GitHubRelease) => { // Create latest-mac-arm64.yml file and publish - let dmgPath; - let zipPath; + let dmgPath: string; + let zipPath: string; for (const asset of release.assets) { + console.log(`Checking asset: ${asset.name}`); + if (asset.name.endsWith('arm64.zip')) { zipPath = await downloadFileFromGitHub(context, asset, downloadDir); } else if (asset.name.endsWith('arm64.DMG')) { @@ -42,7 +44,7 @@ const createReleaseAssets = async (context: Context, release: GitHubRelease) => } } - if (zipPath === undefined || dmgPath === undefined) { + if (!zipPath || !dmgPath) { const formattedAssets = release.assets.map(asset => ({ name: asset.name, url: asset.url, @@ -58,7 +60,7 @@ const createReleaseAssets = async (context: Context, release: GitHubRelease) => }; const latestArm64FilePath = generateLatestArm64Yml(info, downloadDir); - void uploadReleaseAsset(context, release, latestArm64FilePath); + await uploadReleaseAsset(context, release, latestArm64FilePath); }; @@ -94,9 +96,9 @@ const modifyReleaseAssets = async () => { } console.log('Renaming release assets for tag', context.targetTag, context.repo); - void renameReleaseAssets(context, release); + await renameReleaseAssets(context, release); console.log('Creating latest-mac-arm64.yml asset for tag', context.targetTag, context.repo); - void createReleaseAssets(context, release); + await createReleaseAssets(context, release); }; void modifyReleaseAssets();