From ff26246295c7c026068e5ed4580f9a5ef2a715bc Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Mon, 15 May 2023 15:57:44 -0300 Subject: [PATCH] CI move prebuilds file --- .github/workflows/testProject.yml | 2 ++ scripts/build.mjs | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/testProject.yml b/.github/workflows/testProject.yml index a5fcd4c..fea0bc3 100644 --- a/.github/workflows/testProject.yml +++ b/.github/workflows/testProject.yml @@ -75,6 +75,7 @@ jobs: - name: Upload generate interface uses: actions/upload-artifact@v3 with: + retention-days: 7 name: prebuilds_${{ matrix.os }} path: "prebuilds/**" @@ -106,6 +107,7 @@ jobs: uses: actions/download-artifact@v3 with: path: ./prebuilds + name: - run: npm install --no-save - run: npm pack diff --git a/scripts/build.mjs b/scripts/build.mjs index 46310f9..f9ced74 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -25,6 +25,21 @@ async function exist(path) { return fs.open(path).then(() => true).catch(() => false); } +if (await exist(prebuilds)) { + const prebuildsFolder = (await fs.readdir(prebuilds)).filter(file => file.startsWith("prebuilds_")); + for (const folder of prebuildsFolder) { + for (const ff of await fs.readdir(path.join(prebuilds, folder))) { + const folderNewPath = path.resolve(prebuilds, folder, "..", ff); + if (await exist(folderNewPath)) await fs.rm(folderNewPath, {recursive: true, force: true}); + await fs.mkdir(folderNewPath); + for (const file of await fs.readdir(path.join(prebuilds, folder, ff))) { + await fs.rename(path.join(prebuilds, folder, ff, file), path.join(folderNewPath, file)); + } + } + await fs.rm(path.join(prebuilds, folder), {recursive: true, force: true}); + } +} + if (process.argv.slice(2).at(0) === "build") { let archs = []; if (process.argv.includes("--auto")) {