Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
Update README and add Publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirherobrine23 authored Oct 20, 2022
1 parent 50e89bf commit 5b40b32
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish package
on:
release:
types:
- prereleased
- released

jobs:
publishpackage:
runs-on: ubuntu-latest
name: Publish
steps:
- uses: actions/checkout@v3
name: Code checkout
with:
persist-credentials: true
ref: main
fetch-depth: 2
submodules: true

# Install basic tools
- uses: actions/setup-node@v3
name: Setup node.js
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- run: sudo npm install -g ts-node typescript
name: Install typescript and ts-node

- name: Edit version
shell: node {0}
run: |
const fs = require("fs");
const path = require("path");
const packagePath = path.join(process.cwd(), "package.json");
const package = JSON.parse(fs.readFileSync(packagePath, "utf8"));
package.version = "${{ github.ref }}";
package.version = package.version.replace(/[A-Za-z_\/]+/, "");
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2));
# Add version to environment variables
- name: Add version to environment variables
run: |
cat package.json | jq -r '.version' > /tmp/version.txt
echo "PACKAGE_VERSION=$(cat /tmp/version.txt)" >> $GITHUB_ENV
# Install depencides and build
- run: npm ci

# Build
- run: npm run build

# Publish
- run: npm publish --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}

# Create pull request to update version in main branch
- uses: peter-evans/create-pull-request@v4
name: Create Pull Request
continue-on-error: true
with:
commit-message: Update version v${{ env.PACKAGE_VERSION }}
delete-branch: true
assignees: SirHerobrine23
reviewers: SirHerobrine23
branch: update-version
title: Update package version v${{ env.PACKAGE_VERSION }}
body: Auto update package version, created with GitHub Actions

- name: Setup QEMU to Docker
uses: docker/setup-qemu-action@v2

- name: Setup Buildx
uses: docker/setup-buildx-action@v2

- name: Login into registry Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v3
with:
cache-from: ${{ github.event_name == 'push' && 'type=gha,scope=${{ github.ref }}_${{ github.repo }}' || '' }}
platforms: "linux/amd64,linux/arm64,linux/arm/v7"
cache-to: type=gha,scope=${{ github.ref }}_${{ github.repo }}
context: ./
push: true
tags: |
ghcr.io/the-bds-maneger/bdsd:latest
ghcr.io/the-bds-maneger/container:latest
ghcr.io/the-bds-maneger/bdsd:v${{ env.PACKAGE_VERSION }}
ghcr.io/the-bds-maneger/container:v${{ env.PACKAGE_VERSION }}
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# BDSd
# The new BDSd

Maneger you minecraft with API with local daemon or in Docker container.
A unified way to manage multiple Minecraft java and Bedrock servers inside the container or locally.

## What's is BDSd

BDSd is 'B'e'd'rock 'S'server 'd'aemon, but it not only manages Bedrock, also java and derivatives as it ended up becoming a global platform to manage Minecraft Servers

## Install BDSd

- npx: `npx @the-bds-maneger/bdsd`
- Windows: `npm install -g @the-bds-maneger/bdsd`
- MacOS/Linux: `sudo npm install -g @the-bds-maneger/bdsd`
- Android/Termux: `npm install -g @the-bds-maneger/bdsd`

## Migrate `Container`/`bds-cli` to new BDSd

I know that sudden changes are bad, but it always comes with improvements.

the `Bds Cli` folks can get pretty used to it as most commands will be preserved inside the `local bdsd`.

the `Container` folks will have to make a big change because they haven't been updated for more than two major `Bds Maneger core` updates, sorry but you'll have to manually migrate your container because I don't know which version you stopped!

you will have to migrate using `bdsd server migrate <PATH>` and if you use mount volumes it has a different `PATH` than `/data` because `THIS PATH` is DEFAULT from servers from BDSd to containers and attach a shell inside the container in order to run `bdsd server migrate <PATH>`.

## Daemon API

A faster way to manage Minecraft servers without having to crash your main terminal or leave a window open¹ to keep running your server.

> **Note**
>
> 1. You still need a way to leave the daemon service in the background as it is a service that exposes a Unix socket by default in the `temporary` system folder and can be changed with the `BDSD_SOCKET` ENV or the `--socket` option when starting the service.
>
> 2. The `Container` folks will have to get used to the new API standard which is located in the `/v2` (alias to `/`) and `/v1` (deprecated use `/v2`) routes.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const yargs = Yargs(process.argv.slice(2)).help().version(false).alias("h", "hel
alias: "S",
type: "string",
description: "unix socket listen",
default: path.join(os.tmpdir(), "bdsd.sock"),
default: process.env.BDSD_SOCKET?path.resolve(process.env.BDSD_SOCKET):path.join(os.tmpdir(), "bdsd.sock"),
}).option("auth_key", {
alias: "a",
type: "boolean",
Expand Down Expand Up @@ -101,6 +101,9 @@ const yargs = Yargs(process.argv.slice(2)).help().version(false).alias("h", "hel
const requestStop = (id?: string) => bdsCore.httpRequest.getJSON(`${options.host}/stop${id?"":"/all"}`, {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({id})}).catch(() => bdsCore.httpRequest.getJSON(`http://unix:${options.socket}:/stop${id?"":"/all"}`, {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({id})}));
if (ids.length === 0) return requestStop().then((data: {id: string, exitCode: number}[]) => data.forEach(data => console.log("Server ID: %s\n\tCode Exit: %f", data.id, data.exitCode)));
else return Promise.all(ids.map((id: string) => requestStop(id).then(console.log).catch(console.error)));
}).command("migrate", "Migrate your existing servers to the daemon", async yargs => {
yargs.parseSync();
throw new Error("Under construction, wait for the next version");
}).parseAsync();
}).command("local", "Run server localy", async yargs => {
return yargs.command("install", "Install server", async yargs => {
Expand Down

0 comments on commit 5b40b32

Please sign in to comment.