V6 initial #507
21
.github/spigotBuilld/index.mjs
vendored
Normal file
21
.github/spigotBuilld/index.mjs
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
import { createReadStream, promises as fs } from "node:fs";
|
||||
import { execFileSync } from "child_process";
|
||||
import { tmpdir } from "os";
|
||||
import coreUtils from "@sirherobrine23/coreutils";
|
||||
import path from "path";
|
||||
const oracleBucket = await coreUtils.oracleBucket("sa-saopaulo-1", "bdsFiles", "grwodtg32n4d", process.env.OCI_AUTHKEY?.trim());
|
||||
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
||||
let version = process.argv.find(arg => arg.startsWith("--version="))?.split("=")?.[1]?.trim() ?? "latest";
|
||||
|
||||
const buildFile = await coreUtils.httpRequestLarge.saveFile("https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar");
|
||||
execFileSync("java", ["-jar", buildFile, "--rev", version, "-o", __dirname], {
|
||||
cwd: tmpdir(),
|
||||
stdio: "inherit"
|
||||
});
|
||||
|
||||
const SpigotFile = (await fs.readdir(__dirname)).find(file => file.endsWith(".jar"));
|
||||
if (!SpigotFile) throw new Error("No spigot file found");
|
||||
if (version === "latest") version = SpigotFile.split("-")[1].split(".")[0];
|
||||
await oracleBucket.uploadFile(path.posix.join("SpigotBuild", version+".jar"), createReadStream(fileBuild));
|
||||
await Promise.all((await fs.readdir(__dirname)).filter(file => file.endsWith(".jar")).map(file => fs.unlink(file)));
|
7
.github/uploadphp/index.mjs
vendored
7
.github/uploadphp/index.mjs
vendored
@@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
import coreutils from "@sirherobrine23/coreutils";
|
||||
import fs from "node:fs/promises";
|
||||
import { createReadStream } from "node:fs";
|
||||
import coreutils from "@sirherobrine23/coreutils";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs/promises";
|
||||
if (!process.env.OCI_AUTHKEY) throw new Error("No key auth");
|
||||
const ociKeyAuth = process.env.OCI_AUTHKEY.trim();
|
||||
console.log("using key to upload '%s'", ociKeyAuth);
|
||||
|
||||
const files = (await coreutils.extendFs.readdirrecursive(path.join(process.cwd(), "phpOutput"))).filter(file => file.endsWith(".tar.gz")||file.endsWith(".zip")||file.endsWith(".tgz"));
|
||||
const files = (await coreutils.extendFs.readdir({folderPath: path.join(process.cwd(), "phpOutput")})).filter(file => file.endsWith(".tar.gz")||file.endsWith(".zip")||file.endsWith(".tgz"));
|
||||
await Promise.all(files.map(async file => {
|
||||
const fileName = path.basename(file);
|
||||
console.log("Uploading %s", fileName);
|
||||
// https://docs.oracle.com/en-us/iaas/api/#/en/objectstorage/20160918/Object/PutObject
|
||||
await coreutils.httpRequest.bufferFetch({
|
||||
url: `https://objectstorage.sa-saopaulo-1.oraclecloud.com/p/${ociKeyAuth}/n/grwodtg32n4d/b/bdsFiles/o/php_bin/${fileName.toLowerCase()}`,
|
||||
method: "PUT",
|
||||
|
87
.github/workflows/spigotBuild.yaml
vendored
Normal file
87
.github/workflows/spigotBuild.yaml
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
name: Spigot Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 */2 * 0"
|
||||
push:
|
||||
# branches:
|
||||
# - main
|
||||
# paths:
|
||||
# - ".github/workflows/php_buid.yml"
|
||||
# - ".github/uploadphp/**/*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- latest
|
||||
- "1.19.2"
|
||||
- "1.19.1"
|
||||
- "1.19"
|
||||
- "1.18.2"
|
||||
- "1.18.1"
|
||||
- "1.18-rc3"
|
||||
- "1.18-pre8"
|
||||
- "1.18-pre5"
|
||||
- "1.18"
|
||||
- "1.17.1"
|
||||
- "1.17"
|
||||
- "1.16.5"
|
||||
- "1.16.4"
|
||||
- "1.16.3"
|
||||
- "1.16.2"
|
||||
- "1.16.1"
|
||||
- "1.15.2"
|
||||
- "1.15.1"
|
||||
- "1.15"
|
||||
- "1.14.4"
|
||||
- "1.14.3-pre4"
|
||||
- "1.14.3"
|
||||
- "1.14.2"
|
||||
- "1.14.1"
|
||||
- "1.14-pre5"
|
||||
- "1.14"
|
||||
- "1.13.2"
|
||||
- "1.13.1"
|
||||
- "1.13-pre7"
|
||||
- "1.13"
|
||||
- "1.12.2"
|
||||
- "1.12.1"
|
||||
- "1.12"
|
||||
- "1.11.2"
|
||||
- "1.11.1"
|
||||
- "1.11"
|
||||
- "1.10.2"
|
||||
- "1.10"
|
||||
- "1.9.4"
|
||||
- "1.9.2"
|
||||
- "1.9"
|
||||
- "1.8.8"
|
||||
- "1.8.7"
|
||||
- "1.8.6"
|
||||
- "1.8.5"
|
||||
- "1.8.4"
|
||||
- "1.8.3"
|
||||
- "1.8"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Code checkout
|
||||
|
||||
- name: Install ${{ startsWith(matrix.version, 'latest') && '19' || (startsWith(matrix.version, '1.19')||startsWith(matrix.version, '1.18')) && '17' || startsWith(matrix.version, '1.17') && '16' || '8' }} java
|
||||
uses: actions/setup-java@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
distribution: liberica
|
||||
java-version: ${{ (startsWith(matrix.version, 'latest')||startsWith(matrix.version, '1.19')||startsWith(matrix.version, '1.18')) && '17' || startsWith(matrix.version, '1.17') && '16' || '8' }}
|
||||
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
name: Setup node.js
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- run: npm ci && node .github/spigotBuilld/index.mjs --version=${{ matrix.version || 'latest' }}
|
||||
env:
|
||||
OCI_AUTHKEY: "${{ secrets.OCI_AUTHKEY }}"
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -11,4 +11,7 @@ muslCrossMake/
|
||||
phpOutput/
|
||||
*.tar.gz
|
||||
*.tgz
|
||||
*.zip
|
||||
*.zip
|
||||
|
||||
# Spigot
|
||||
*.jar
|
@@ -2,15 +2,16 @@ import { createServerManeger, platformPathID, pathOptions, serverConfig } from "
|
||||
import { promises as fs, createWriteStream } from "node:fs";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import coreUtils, { childPromisses } from "@sirherobrine23/coreutils";
|
||||
import { promisify } from "node:util";
|
||||
import path from "node:path";
|
||||
import tar from "tar";
|
||||
import AdmZip from "adm-zip";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
export type bedrockRootOption = pathOptions & {
|
||||
variant?: "oficial"|"Pocketmine-PMMP"|"Powernukkit"|"Cloudbust"
|
||||
};
|
||||
|
||||
const oracleBucket = await coreUtils.oracleBucket("sa-saopaulo-1", "bdsFiles", "grwodtg32n4d", "0IKM-5KFpAF8PuWoVe86QFsF4sipU2rXfojpaOMEdf4QgFQLcLlDWgMSPHWmjf5W");
|
||||
const hostArchEmulate = [
|
||||
"qemu-x86_64-static",
|
||||
"qemu-x86_64",
|
||||
@@ -38,7 +39,6 @@ async function getPHPBin(options?: bedrockRootOption) {
|
||||
return file;
|
||||
}
|
||||
|
||||
const oracleBucket = await coreUtils.oracleBucket("sa-saopaulo-1", "bdsFiles", "grwodtg32n4d", "0IKM-5KFpAF8PuWoVe86QFsF4sipU2rXfojpaOMEdf4QgFQLcLlDWgMSPHWmjf5W");
|
||||
export async function installServer(version: string, options?: bedrockRootOption) {
|
||||
options = {variant: "oficial", ...options};
|
||||
const serverPath = await platformPathID("bedrock", options);
|
||||
|
14
src/platform/Java.ts
Normal file
14
src/platform/Java.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { pathOptions } from "../serverManeger.js";
|
||||
|
||||
export type javaRootOption = pathOptions & {
|
||||
variant?: "oficial"|"Spigot"|"Paper"|"Purpur",
|
||||
};
|
||||
|
||||
export async function installServer(options?: javaRootOption) {
|
||||
options = {variant: "oficial", ...options};
|
||||
|
||||
if (options?.variant === "Paper") {}
|
||||
}
|
||||
|
||||
export default startServer;
|
||||
export async function startServer(options?: javaRootOption) {}
|
Reference in New Issue
Block a user