Skip to content

Commit

Permalink
ci: testing upload build script
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrannychaseroperation committed Dec 10, 2024
1 parent 9e73a44 commit 639c7ef
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions scripts/upload-build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ fs.readdir(dist, async (err, files) => {
if (err) throw err;

const uploads = await Promise.all(
files.map(async (file) => {
if (extensionsToUpload.includes(path.extname(file))) {
files
.filter((file) => extensionsToUpload.includes(path.extname(file)))
.map(async (file) => {
const fileName = `${new Date().getTime()}-${file}`;

const command = new PutObjectCommand({
Expand All @@ -42,20 +43,21 @@ fs.readdir(dist, async (err, files) => {
url: `${process.env.S3_ENDPOINT}/${process.env.S3_BUILDS_BUCKET_NAME}/${fileName}`,
name: fileName,
};
}
})
})
);

await fetch(process.env.BUILD_WEBHOOK_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
uploads,
branchName: process.env.BRANCH_NAME,
version: packageJson.version,
githubActor: process.env.GITHUB_ACTOR,
}),
});
if (uploads.length > 0) {
await fetch(process.env.BUILD_WEBHOOK_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
uploads,
branchName: process.env.BRANCH_NAME,
version: packageJson.version,
githubActor: process.env.GITHUB_ACTOR,
}),
});
}
});

0 comments on commit 639c7ef

Please sign in to comment.