From 938e750ba3e6125cabac49e37eb8c1a7583a3648 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 20 Mar 2024 09:48:20 +0100 Subject: [PATCH] test yml --- .circleci/config.yml | 1 + .../ci/update_desktop_release_assets.ts | 36 +++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 14eeb2b503..f05951e50b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -438,6 +438,7 @@ jobs: yarn installRipGrepMacOXarm64 PUBLISH_FOR_PULL_REQUEST='false' USE_HARD_LINKS=false yarn dist --arm64 cat release/latest-mac.yml + cp release/latest-mac-arm64.yml - run: command: | nvm use 20 diff --git a/apps/remix-ide/ci/update_desktop_release_assets.ts b/apps/remix-ide/ci/update_desktop_release_assets.ts index 7a435ae5e5..5fe3d674a4 100644 --- a/apps/remix-ide/ci/update_desktop_release_assets.ts +++ b/apps/remix-ide/ci/update_desktop_release_assets.ts @@ -1,4 +1,4 @@ -import {Octokit} from 'octokit' +import { Octokit } from 'octokit' import * as fs from 'fs' import * as path from 'path' import YAML from 'yaml' @@ -126,12 +126,12 @@ async function main() { for (const file of ymlFiles) { const content = fs.readFileSync(path.join(__dirname, '../../../release', file), 'utf8') const parsed = YAML.parse(content) - const hashes:{ + const hashes: { url: string, sha512: string, size: number }[] = [] - if(parsed.files) { + if (parsed.files) { console.log(`Found`, parsed.files) for (const f of parsed.files) { const executable = f.url @@ -139,10 +139,10 @@ async function main() { if (!exists) { console.log(`File ${executable} does not exist on local fs. Skipping...`) continue - }else{ + } else { console.log(`File ${executable} exists on local fs. Recalculating hash...`) // calculate sha512 hash of executable - const hash:string = await hashFile(path.join(__dirname, '../../../release', executable)) + const hash: string = await hashFile(path.join(__dirname, '../../../release', executable)) console.log(hash) // calculate file size of executable const stats = fs.statSync(path.join(__dirname, '../../../release', executable)) @@ -153,7 +153,7 @@ async function main() { sha512: hash, size: fileSizeInBytes }) - if(parsed.path === executable) { + if (parsed.path === executable) { parsed.sha512 = hash parsed.size = fileSizeInBytes } @@ -168,6 +168,30 @@ async function main() { let files = await readReleaseFilesFromLocalDirectory() + try { + if (fs.existsSync(path.join(__dirname, '../../../release', 'latest-mac-arm64.yml')) && fs.existsSync(path.join(__dirname, '../../../release', 'latest-mac.yml'))) { + // combine the two files + const macArm64 = fs.readFileSync(path.join(__dirname, '../../../release', 'latest-mac-arm64.yml'), 'utf8') + const mac = fs.readFileSync(path.join(__dirname, '../../../release', 'latest-mac.yml'), 'utf8') + const parsedMacArm64 = YAML.parse(macArm64) + const parsedMac = YAML.parse(mac) + const combined = { + ...parsedMac, + files: { + ...parsedMac.files, + ...parsedMacArm64.files + } + } + console.log(combined) + const newYml = YAML.stringify(combined) + fs.writeFileSync(path.join(__dirname, '../../../release', 'latest-mac.yml'), newYml) + // remove the arm64 file + fs.unlinkSync(path.join(__dirname, '../../../release', 'latest-mac-arm64.yml')) + } + } catch (e) { + console.log(e) + } + files = files.filter((file) => file.endsWith('.zip') || file.endsWith('.dmg') || file.endsWith('.exe') || file.endsWith('.AppImage') || file.endsWith('.snap') || file.endsWith('.deb') || file.startsWith('latest')) console.log(`Found ${files.length} files to upload`) console.log(files)