mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
ci: testing upload build script
This commit is contained in:
parent
09cf207ecc
commit
2c93312df0
2 changed files with 56 additions and 49 deletions
|
@ -3,6 +3,11 @@ const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3");
|
|||
const path = require("node:path");
|
||||
const packageJson = require("../package.json");
|
||||
|
||||
if (!process.env.BUILD_WEBHOOK_URL) {
|
||||
console.log("No BUILD_WEBHOOK_URL provided, skipping upload");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const s3 = new S3Client({
|
||||
region: "auto",
|
||||
endpoint: process.env.S3_ENDPOINT,
|
||||
|
@ -20,7 +25,7 @@ const extensionsToUpload = [".deb", ".exe", ".png"];
|
|||
fs.readdir(dist, async (err, files) => {
|
||||
if (err) throw err;
|
||||
|
||||
const results = await Promise.all(
|
||||
const uploads = await Promise.all(
|
||||
files.map(async (file) => {
|
||||
if (extensionsToUpload.includes(path.extname(file))) {
|
||||
const fileName = `${new Date().getTime()}-${file}`;
|
||||
|
@ -47,9 +52,10 @@ fs.readdir(dist, async (err, files) => {
|
|||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
results,
|
||||
uploads,
|
||||
branchName: process.env.BRANCH_NAME,
|
||||
version: packageJson.version,
|
||||
actor: process.env.GITHUB_ACTOR,
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue