Skip to content

Commit

Permalink
CI move prebuilds file
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirherobrine23 committed May 15, 2023
1 parent c92d5cb commit ff26246
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/testProject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
- name: Upload generate interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ matrix.os }}
path: "prebuilds/**"

Expand Down Expand Up @@ -106,6 +107,7 @@ jobs:
uses: actions/download-artifact@v3
with:
path: ./prebuilds
name:

- run: npm install --no-save
- run: npm pack
Expand Down
15 changes: 15 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit ff26246

Please sign in to comment.