mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
ci: testing upload build script
This commit is contained in:
parent
7e44b3dedb
commit
fa273a13f2
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@ -2,9 +2,6 @@ name: Build
|
|||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
env:
|
|
||||||
AWS_REGION: us-east-1
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
@ -17,6 +14,16 @@ jobs:
|
|||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Test Upload build
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
|
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
|
||||||
|
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
|
||||||
|
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
|
||||||
|
S3_BUILDS_BUCKET_NAME: ${{ secrets.S3_BUILDS_BUCKET_NAME }}
|
||||||
|
BUILD_WEBHOOK_URL: ${{ secrets.BUILD_WEBHOOK_URL }}
|
||||||
|
run: node scripts/upload-build.cjs
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"start": "electron-vite preview",
|
"start": "electron-vite preview",
|
||||||
"dev": "electron-vite dev",
|
"dev": "electron-vite dev",
|
||||||
"build": "npm run typecheck && electron-vite build",
|
"build": "npm run typecheck && electron-vite build",
|
||||||
"postinstall": "electron-builder install-app-deps && node ./postinstall.cjs",
|
"postinstall": "electron-builder install-app-deps && node ./scripts/postinstall.cjs",
|
||||||
"build:unpack": "npm run build && electron-builder --dir",
|
"build:unpack": "npm run build && electron-builder --dir",
|
||||||
"build:win": "electron-vite build && electron-builder --win",
|
"build:win": "electron-vite build && electron-builder --win",
|
||||||
"build:mac": "electron-vite build && electron-builder --mac",
|
"build:mac": "electron-vite build && electron-builder --mac",
|
||||||
@ -78,6 +78,7 @@
|
|||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@aws-sdk/client-s3": "^3.705.0",
|
||||||
"@commitlint/cli": "^19.5.0",
|
"@commitlint/cli": "^19.5.0",
|
||||||
"@commitlint/config-conventional": "^19.5.0",
|
"@commitlint/config-conventional": "^19.5.0",
|
||||||
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
|
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
const { default: axios } = require("axios");
|
|
||||||
const util = require("node:util");
|
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
|
||||||
|
|
||||||
const exec = util.promisify(require("node:child_process").exec);
|
|
||||||
|
|
||||||
const fileName = {
|
|
||||||
win32: "ludusavi-v0.25.0-win64.zip",
|
|
||||||
linux: "ludusavi-v0.25.0-linux.zip",
|
|
||||||
darwin: "ludusavi-v0.25.0-mac.zip",
|
|
||||||
};
|
|
||||||
|
|
||||||
const downloadLudusavi = async () => {
|
|
||||||
if (fs.existsSync("ludusavi")) {
|
|
||||||
console.log("Ludusavi already exists, skipping download...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const file = fileName[process.platform];
|
|
||||||
const downloadUrl = `https://github.com/mtkennerly/ludusavi/releases/download/v0.25.0/${file}`;
|
|
||||||
|
|
||||||
console.log(`Downloading ${file}...`);
|
|
||||||
|
|
||||||
const response = await axios.get(downloadUrl, { responseType: "stream" });
|
|
||||||
|
|
||||||
const stream = response.data.pipe(fs.createWriteStream(file));
|
|
||||||
|
|
||||||
stream.on("finish", async () => {
|
|
||||||
console.log(`Downloaded ${file}, extracting...`);
|
|
||||||
|
|
||||||
const pwd = process.cwd();
|
|
||||||
|
|
||||||
const targetPath = path.join(pwd, "ludusavi");
|
|
||||||
|
|
||||||
await exec(`npx extract-zip ${file} ${targetPath}`);
|
|
||||||
|
|
||||||
if (process.platform !== "win32") {
|
|
||||||
fs.chmodSync(path.join(targetPath, "ludusavi"), 0o755);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Extracted. Renaming folder...");
|
|
||||||
|
|
||||||
console.log(`Extracted ${file}, removing compressed downloaded file...`);
|
|
||||||
fs.rmSync(file);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
downloadLudusavi();
|
|
Loading…
Reference in New Issue
Block a user