Code Modifications #261
@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -ex
|
|
||||||
# Update Debian Repository
|
|
||||||
apt update
|
|
||||||
|
|
||||||
# Install Necessary Packages
|
|
||||||
apt -qq install -y curl wget git sudo unzip zip jq python3 xz-utils tar
|
|
||||||
|
|
||||||
# Install nodejs from github release
|
|
||||||
NODEVERSION=$(curl -sL https://api.github.com/repos/nodejs/node/releases | grep tag_name | cut -d '"' -f 4 | sort -V | tail -n 1)
|
|
||||||
case $(uname -m) in
|
|
||||||
x86_64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-x64.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
aarch64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-arm64.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
armv7l ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-armv7l.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
ppc64el ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-ppc64le.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
s390x ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-s390x.tar.xz" -O /tmp/node.tar.xz;;
|
|
||||||
*) echo "Unsupported architecture"; exit 1;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Extract nodejs
|
|
||||||
mkdir /tmp/Node
|
|
||||||
tar -xJf /tmp/node.tar.xz -C /tmp/Node
|
|
||||||
rm -rf /tmp/node.tar.xz
|
|
||||||
cp -rf /tmp/Node/*/* /usr
|
|
||||||
rm -rf /tmp/Node
|
|
||||||
|
|
||||||
# Install Build Dependencies and others Packages
|
|
||||||
# apt install -y ca-certificates procps lsb-release libatomic1 libnss3 libatk-bridge2.0-0 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxrender1 libxss1 libxtst6 fonts-liberation libnss3 libgbm-dev
|
|
||||||
apt install -y libcurl4-openssl-dev curl
|
|
||||||
|
|
||||||
# Update npm
|
|
||||||
npm -g install npm@latest
|
|
||||||
|
|
||||||
# Install Dependencies to diferent architectures
|
|
||||||
if ! [ "$(uname -m)" == "x86_64" ];then
|
|
||||||
mkdir -p /lib64
|
|
||||||
apt install -y qemu-user-static
|
|
||||||
wget -q "https://github.com/The-Bds-Maneger/external_files/raw/main/Linux/libs_amd64.zip" -O /tmp/libries.zip
|
|
||||||
unzip -o /tmp/libries.zip -d /
|
|
||||||
rm -rfv /tmp/libries.zip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install openjdk
|
|
||||||
case "$(apt search openjdk)" in
|
|
||||||
*openjdk-17* ) apt install -y openjdk-17*;;
|
|
||||||
*openjdk-11* ) apt install -y openjdk-11*;;
|
|
||||||
* ) echo "No openjdk version found, skipping";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Remove Unnecessary Packages
|
|
||||||
apt autoremove -y
|
|
||||||
|
|
||||||
# Clean up apt cache
|
|
||||||
apt clean -y
|
|
||||||
|
|
||||||
# Remove Unnecessary Files
|
|
||||||
rm -rf /var/lib/apt/lists/* /root/.gnupg /tmp/*
|
|
||||||
|
|
||||||
# Sucessfully installed
|
|
||||||
exit 0
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
const path = require("path");
|
|
||||||
process.env.Docker_Root = path.resolve(__dirname, "../");
|
|
||||||
const Docker = require("docker-run_build");
|
|
||||||
Docker.Build().then(() => {
|
|
||||||
Docker.Run().catch((e) => {
|
|
||||||
console.log(e);
|
|
||||||
process.exit(2);
|
|
||||||
});
|
|
||||||
}).catch(e => {
|
|
||||||
console.log(e);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
const child_process = require("child_process");
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
const cli_color = require("cli-color");
|
|
||||||
|
|
||||||
async function Render() {
|
|
||||||
// Fetch
|
|
||||||
if (typeof fetch === "undefined") global.fetch = (await import("node-fetch")).default;
|
|
||||||
fetch("https://registry.npmjs.org/@the-bds-maneger/core").then(res => res.json()).then(data => {
|
|
||||||
data.versions = Object.getOwnPropertyNames(data.versions).filter(version => /[0-9]+\.[0-9][0-9][0-9]/.test(version) && version !== data["dist-tags"].dev && version !== data["dist-tags"].latest)
|
|
||||||
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
|
||||||
const Package = require("../package.json");
|
|
||||||
data.versions.map(version => {
|
|
||||||
const cmd = `npm unpublish ${Package.name}@${version}`;
|
|
||||||
console.log(cli_color.yellow(cmd));
|
|
||||||
try {
|
|
||||||
child_process.execSync(cmd).toString()
|
|
||||||
console.log(cli_color.green(`Sucess to remove ${Package.name}@${version}`, "\n"));
|
|
||||||
return cmd;
|
|
||||||
} catch (e) {
|
|
||||||
console.log(cli_color.red(`Failed to remove package: ${Package.name}@${version}`), "\n");
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Render();
|
|
@ -1,4 +0,0 @@
|
|||||||
const version = require("../package.json").version;
|
|
||||||
const ActionsCore = require("@actions/core");
|
|
||||||
console.log(version);
|
|
||||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
|
@ -1,19 +0,0 @@
|
|||||||
(async ()=>{
|
|
||||||
try {
|
|
||||||
const bds = require("../../index");
|
|
||||||
await bds.download("latest", true);
|
|
||||||
console.log("Api:", bds.api());
|
|
||||||
console.log("Backup:", bds.backup());
|
|
||||||
console.log("Detect Server:", bds.detect());
|
|
||||||
console.log("Kill Server:", bds.kill());
|
|
||||||
console.log("Get Config:", bds.get_config());
|
|
||||||
console.log("Start:", bds.start());
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log("Kill Server:", bds.kill());
|
|
||||||
setTimeout(() => process.exit(0), 1000);
|
|
||||||
}, 1 * 30 * 1000);
|
|
||||||
} catch (err) {
|
|
||||||
console.log("Detect Error:", err);
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
})()
|
|
6
.github/ChangeVersion.js
vendored
6
.github/ChangeVersion.js
vendored
@ -1,6 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
const Package_JSon = JSON.parse(fs.readFileSync(process.cwd()+'/package.json', 'utf8'));
|
|
||||||
const run_ID = process.env.RunID || "1111111111111111111111111111111111111";
|
|
||||||
Package_JSon.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
|
||||||
fs.writeFileSync(process.cwd()+'/package.json', JSON.stringify(Package_JSon, null, 2));
|
|
||||||
console.log(Package_JSon.version);
|
|
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: npm
|
||||||
directory: "/"
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: daily
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: daily
|
||||||
|
21
.github/workflows/PullRequest.yml
vendored
21
.github/workflows/PullRequest.yml
vendored
@ -1,31 +1,10 @@
|
|||||||
name: Docker And Node Test
|
name: Docker And Node Test
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CodeQL:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: "javascript"
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
Node:
|
Node:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
107
.github/workflows/main.yml
vendored
107
.github/workflows/main.yml
vendored
@ -1,107 +0,0 @@
|
|||||||
name: Publish dev npm package and Docker Image
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
CodeQL:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: "javascript"
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
npm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Npm and Node Setup
|
|
||||||
uses: actions/setup-node@v2.5.0
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
- name: Edit Version
|
|
||||||
env:
|
|
||||||
RunID: ${{ github.run_id }}
|
|
||||||
run: node .github/ChangeVersion.js
|
|
||||||
|
|
||||||
- name: Install Packages
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: NPM Publish
|
|
||||||
run: npm publish --tag dev
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
DockerImage:
|
|
||||||
needs:
|
|
||||||
- npm
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build Docker Image to Bds Core and Bds Base
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Install Node Depedencies
|
|
||||||
run: npm install --no-save -d
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: Get And Export Release Version
|
|
||||||
shell: node -p '{0}'
|
|
||||||
run: |
|
|
||||||
const version = require("./package.json").version;
|
|
||||||
const ActionsCore = require("@actions/core");
|
|
||||||
console.log(version);
|
|
||||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger Base)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdsbase
|
|
||||||
tags: ghcr.io/the-bds-maneger/base:main
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger core)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdscore
|
|
||||||
cache-from: ghcr.io/the-bds-maneger/base:main
|
|
||||||
tags: ghcr.io/the-bds-maneger/core:main
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
83
.github/workflows/relelases.yml
vendored
83
.github/workflows/relelases.yml
vendored
@ -1,83 +0,0 @@
|
|||||||
name: Publish Releases
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- created
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
npm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ github.actor }} == ${{ github.repository_owner }} && (contains('tag', ${{ github.ref }}) && contains('v', ${{ github.ref }}) || contains('V', ${{ github.ref }}))
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- uses: actions/setup-node@v2.5.0
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
- name: Install Depedencies
|
|
||||||
run: npm install --no-save
|
|
||||||
|
|
||||||
- name: Install node depedencies
|
|
||||||
run: npm run esm_module
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
continue-on-error: true
|
|
||||||
run: npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
- name: Remove Dev Versions
|
|
||||||
run: npm run cirelease
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
|
||||||
|
|
||||||
DockerImage:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build Docker Image to Bds Core and Bds Base
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Install Node Depedencies
|
|
||||||
run: npm install --no-save -d
|
|
||||||
|
|
||||||
- name: Get And Export Release Version
|
|
||||||
run: node .Build/SetCIEnvs.js
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger Base)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdsbase
|
|
||||||
tags: |
|
|
||||||
ghcr.io/the-bds-maneger/base:latest
|
|
||||||
ghcr.io/the-bds-maneger/base:${{ env.BdsCoreVersion }}
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
||||||
|
|
||||||
- name: Build Docker image (Bds Maneger core)
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
target: bdscore
|
|
||||||
cache-from: ghcr.io/the-bds-maneger/base:latest
|
|
||||||
tags: |
|
|
||||||
ghcr.io/the-bds-maneger/core:latest
|
|
||||||
ghcr.io/the-bds-maneger/core:${{ env.BdsCoreVersion }}
|
|
||||||
platforms: ${{ env.DOCKER_ARCH }}
|
|
184
.github/workflows/root.yml
vendored
Normal file
184
.github/workflows/root.yml
vendored
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
name: "Publish Packages"
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released
|
||||||
|
jobs:
|
||||||
|
CodeQL:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: "javascript"
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node_version:
|
||||||
|
- 15.x
|
||||||
|
- 16.x
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.JS and NPM
|
||||||
|
uses: actions/setup-node@v2.5.0
|
||||||
|
with:
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
node-version: ${{ matrix.node_version }}
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
npm:
|
||||||
|
name: Npm Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [test]
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node.JS and NPM
|
||||||
|
uses: actions/setup-node@v2.5.0
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
|
- name: Edit Version to next release
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const fs = require("fs");
|
||||||
|
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
|
||||||
|
const run_ID = "${{ github.run_id }}";
|
||||||
|
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
||||||
|
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
|
||||||
|
console.log("New Version to Package:", JsonPackage.version);
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
run: npm install -d
|
||||||
|
|
||||||
|
- name: ESM Modules
|
||||||
|
run: npm run esm_module
|
||||||
|
|
||||||
|
- name: Remove Dev Version
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const child_process = require("child_process");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const cli_color = require("cli-color");
|
||||||
|
(async function() {
|
||||||
|
global.fetch = (await import("node-fetch")).default;
|
||||||
|
fetch("https://registry.npmjs.org/@the-bds-maneger/core").then(res => res.json()).then(data => {
|
||||||
|
data.versions = Object.getOwnPropertyNames(data.versions).filter(version => /[0-9]+\.[0-9][0-9][0-9]/.test(version) && version !== data["dist-tags"].dev && version !== data["dist-tags"].latest)
|
||||||
|
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
||||||
|
const Package = require("../package.json");
|
||||||
|
data.versions.map(version => {
|
||||||
|
const cmd = `npm unpublish ${Package.name}@${version}`;
|
||||||
|
console.log(cli_color.yellow(cmd));
|
||||||
|
try {
|
||||||
|
child_process.execSync(cmd).toString()
|
||||||
|
console.log(cli_color.green(`Sucess to remove ${Package.name}@${version}`, "\n"));
|
||||||
|
return cmd;
|
||||||
|
} catch (e) {
|
||||||
|
console.log(cli_color.red(`Failed to remove package: ${Package.name}@${version}`), "\n");
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
|
- name: Publish Package
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "release" ]];then
|
||||||
|
npm publish
|
||||||
|
else
|
||||||
|
npm publish --tag next
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish Docker Image
|
||||||
|
needs: [test]
|
||||||
|
steps:
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Edit Version to next release
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const fs = require("fs");
|
||||||
|
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
|
||||||
|
const run_ID = "${{ github.run_id }}";
|
||||||
|
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
|
||||||
|
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
|
||||||
|
console.log("New Version to Package:", JsonPackage.version);
|
||||||
|
|
||||||
|
|
||||||
|
- name: Get Version and Set in Env
|
||||||
|
shell: node {0}
|
||||||
|
run: |
|
||||||
|
const { version } = require("../package.json");
|
||||||
|
const ActionsCore = require("@actions/core");
|
||||||
|
console.log(version);
|
||||||
|
ActionsCore.exportVariable("CoreVersion", version);
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build Bds Maneger Core (Release)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/the-bds-maneger/core:latest
|
||||||
|
ghcr.io/the-bds-maneger/core:${{ env.CoreVersion }}
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
|
||||||
|
- name: Build Bds Maneger Core (Main)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
if: github.event_name != 'release'
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/the-bds-maneger/core:nightly
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
@ -1,2 +0,0 @@
|
|||||||
include:
|
|
||||||
- .gitlab/workflows/*.yml
|
|
@ -1,13 +0,0 @@
|
|||||||
terminal:
|
|
||||||
image: bdsmaneger/core:latest
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- apt update && apt install -y curl &> /dev/null
|
|
||||||
- curl https://get.docker.com | bash -
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
DEVELOP_WEBIDE: true
|
|
||||||
script: sleep 80
|
|
@ -1,19 +0,0 @@
|
|||||||
Docker:
|
|
||||||
image: ubuntu:latest
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_HOST: tcp://docker:2375
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- |
|
|
||||||
apt update && apt install -y curl &> /dev/null
|
|
||||||
curl https://get.docker.com | bash - &> /dev/null
|
|
||||||
docker info
|
|
||||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
|
||||||
docker run --privileged --rm multiarch/qemu-user-static --reset -p yes
|
|
||||||
docker buildx create --name multiarch --driver docker-container --use
|
|
||||||
docker buildx inspect --bootstrap
|
|
||||||
script:
|
|
||||||
- docker buildx build -t bdsmaneger/maneger:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 .
|
|
44
Dockerfile
44
Dockerfile
@ -1,30 +1,42 @@
|
|||||||
# Setup Bds Manerger Project Docker Base
|
FROM ubuntu:latest
|
||||||
FROM debian:testing AS bdsbase
|
|
||||||
USER root
|
USER root
|
||||||
ENV DEBIAN_FRONTEND="noninteractive" DOCKER_IMAGE="true"
|
ENV DEBIAN_FRONTEND="noninteractive" DOCKER_IMAGE="true"
|
||||||
|
|
||||||
# Copy Docker Files
|
# Install Core Packages
|
||||||
COPY .Build/Docker/* /tmp
|
RUN apt update && apt install -y curl wget git sudo unzip zip jq python3 xz-utils tar
|
||||||
|
|
||||||
# Configure BASE
|
# Install Node.js
|
||||||
RUN bash /tmp/Configure.sh
|
RUN NODEVERSION=$(curl -sL https://api.github.com/repos/nodejs/node/releases | grep tag_name | cut -d '"' -f 4 | sort -V | tail -n 1) && \
|
||||||
|
case $(uname -m) in x86_64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-x64.tar.xz" -O /tmp/node.tar.xz;;aarch64 ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-arm64.tar.xz" -O /tmp/node.tar.xz;;armv7l ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-armv7l.tar.xz" -O /tmp/node.tar.xz;;ppc64el ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-ppc64le.tar.xz" -O /tmp/node.tar.xz;;s390x ) wget -q "https://nodejs.org/download/release/$NODEVERSION/node-$NODEVERSION-linux-s390x.tar.xz" -O /tmp/node.tar.xz;;*) echo "Unsupported architecture"; exit 1;;esac && \
|
||||||
|
mkdir /tmp/Node && \
|
||||||
|
tar -xJf /tmp/node.tar.xz -C /tmp/Node && \
|
||||||
|
rm -rf /tmp/node.tar.xz && \
|
||||||
|
cp -rf /tmp/Node/*/* /usr && \
|
||||||
|
rm -rf /tmp/Node
|
||||||
|
|
||||||
# Setup bdsmaneger/core
|
# Update NPM
|
||||||
FROM bdsbase AS bdscore
|
RUN npm -g install npm@latest
|
||||||
|
|
||||||
|
# Install external Libries to ARM64
|
||||||
|
ARG LibrieZip="https://github.com/The-Bds-Maneger/external_files/raw/main/Linux/libs_amd64.zip"
|
||||||
|
RUN if ! [ "$(uname -m)" == "x86_64" ];then mkdir -p /lib64;apt install -y qemu-user-static;wget -q "${LibrieZip}" -O /tmp/libries.zip;unzip -o /tmp/libries.zip -d /;rm -rfv /tmp/libries.zip; fi
|
||||||
|
|
||||||
|
# Install Java
|
||||||
|
RUN case "$(apt search openjdk)" in *openjdk-17* ) apt install -y openjdk-17*;; *openjdk-11* ) apt install -y openjdk-11*;; * ) echo "No openjdk version found, skipping";;esac
|
||||||
|
|
||||||
# Create Volume to Storage Server And Config
|
# Create Volume to Storage Server And Config
|
||||||
VOLUME [ "/root/bds_core" ]
|
VOLUME [ "/root/bds_core" ]
|
||||||
|
|
||||||
# Set default ENVs to Bds Core
|
# Set default ENVs to Bds Core
|
||||||
ENV PLAYERS="5" \
|
ENV PLAYERS="5" \
|
||||||
WORLD_NAME="The Ultimate Server" \
|
WORLD_NAME="The Ultimate Server" \
|
||||||
DESCRIPTION="running Minecraft Server on Bds Maneger by Bds Manager Project" \
|
DESCRIPTION="running Minecraft Server on Bds Maneger by Bds Manager Project" \
|
||||||
GAMEMODE="survival" \
|
GAMEMODE="survival" \
|
||||||
DIFFICULTY="normal" \
|
DIFFICULTY="normal" \
|
||||||
ENABLE_COMMANDS="false" \
|
ENABLE_COMMANDS="false" \
|
||||||
ACCOUNT="false" \
|
ACCOUNT="false" \
|
||||||
SERVER="bedrock" \
|
SERVER="bedrock" \
|
||||||
SERVER_VERSION="true"
|
SERVER_VERSION="true"
|
||||||
|
|
||||||
# Bds Maneger Core required ports
|
# Bds Maneger Core required ports
|
||||||
EXPOSE 19132/udp 19133/udp 1932/tcp
|
EXPOSE 19132/udp 19133/udp 1932/tcp
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node bin/bds_maneger.js -sk",
|
"start": "node bin/bds_maneger.js -sk",
|
||||||
"test": "mocha --exit .test/*.js",
|
"test": "mocha --exit .test/*.js",
|
||||||
"ci": "node .Build/test/ci.js",
|
|
||||||
"esm_module": "cjs2esm",
|
"esm_module": "cjs2esm",
|
||||||
"eslint": "eslint --debug --fix .",
|
"eslint": "eslint --debug --fix .",
|
||||||
"Docker": "docker-compose build && docker-compose up",
|
"Docker": "docker-compose build && docker-compose up"
|
||||||
"cirelease": "node .Build/RemoveVersions.js"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"bds_maneger": "bin/BdsManeger.js"
|
"bds_maneger": "bin/BdsManeger.js"
|
||||||
|
Reference in New Issue
Block a user