Online editor + auto deployment/releases (#264)

* web editor

* editor command help

* editor sync cmd

* removed same user restriction

* removed player executed restriction

* no server identifier sent to server

* editor url updated

* config harsher verification + send world names to editor api

* no more session controls

* addons editor commands

* moved rtp to /betterrtp-core to create a better env for maven compiling

* bettersync lib

* Own core and addon editor schemas with BetterSync validation

* Simplify editor metadata and publish core and addon schemas on release

* Release core and addons together using their Maven versions

* Exclude unavailable ProtocolLib executor snapshot from Addons build

* betterrtp compiling
This commit is contained in:
RonanCraft authored and GitHub committed 2026-11-12 14:17:03 -05:00
1 parent 4697f06163
commit c8c5a04a59
224 files changed
+2041 -388

No files matched your search

@@ -0,0 +1,37 @@
name: Publish editor schema
on:
release:
types: [published]
permissions:
contents: write
jobs:
publish:
if: '!github.event.release.prerelease'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Prepare plugin-owned schemas
env:
SCHEMA_PATHS: BetterRTP-Core/src/main/resources/META-INF/editor-schema.json BetterRTPAddons/src/main/resources/META-INF/editor-schema.json
run: |
node --input-type=module <<'JS'
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
mkdirSync('editor-schemas');
for (const path of process.env.SCHEMA_PATHS.split(' ')) {
const bytes = readFileSync(path), meta = JSON.parse(bytes)['x-bettersync'];
if (meta?.format !== 1 || !/^[a-z0-9-]+$/.test(meta.plugin) || !/^[A-Za-z0-9._-]+$/.test(meta.schemaVersion)) throw new Error('Invalid schema identity');
writeFileSync(`editor-schemas/${meta.plugin}-${meta.schemaVersion}.schema.json`, bytes);
}
JS
- name: Attach schemas to this plugin release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: gh release upload "$RELEASE_TAG" editor-schemas/*.schema.json
+79
View File
@@ -0,0 +1,79 @@
name: Release BetterRTP Maven version
on:
push:
branches: [online-editor]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release-maven-version
cancel-in-progress: false
jobs:
release:
if: github.ref == 'refs/heads/online-editor'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Read BetterRTP Maven version
id: version
shell: bash
run: |
mvn -B -q -f BetterRTP-Core/pom.xml help:evaluate -Dexpression=project.version -Doutput="$RUNNER_TEMP/version-0"
version0=$(cat "$RUNNER_TEMP/version-0")
[[ "$version0" =~ ^[0-9][A-Za-z0-9._-]*$ ]] || { echo "Invalid Maven version"; exit 1; }
[[ "$version0" != *SNAPSHOT* ]] || { echo "Snapshot versions are not released"; exit 1; }
echo "version0=$version0" >> "$GITHUB_OUTPUT"
echo "tag=v$version0" >> "$GITHUB_OUTPUT"
echo "title=BetterRTP $version0" >> "$GITHUB_OUTPUT"
- name: Check for an existing release
id: existing
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ steps.version.outputs.tag }}
run: |
# Listing errors fail the workflow; they are not mistaken for an absent release.
releases=$(gh api --paginate "repos/$GH_REPO/releases?per_page=100" --jq '.[].tag_name')
if printf '%s\n' "$releases" | grep -Fxq "$RELEASE_TAG"; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Release $RELEASE_TAG already exists; bump the Maven version for another release."
fi
- name: Build and test
if: steps.existing.outputs.exists != 'true'
run: |
mvn -B -pl :BetterRTP clean verify
mvn -B -f tests/editor/pom.xml verify
- name: Prepare BetterRTP JAR and editor schemas
if: steps.existing.outputs.exists != 'true'
env:
# The website still needs Addons field metadata; this does not build its JAR.
SCHEMA_PATHS: BetterRTP-Core/src/main/resources/META-INF/editor-schema.json BetterRTPAddons/src/main/resources/META-INF/editor-schema.json
run: |
mkdir release-assets
cp "dist/BetterRTP-${{ steps.version.outputs.version0 }}.jar" release-assets/
python3 - <<'PYTHON'
import json, os, pathlib, re
for path in os.environ['SCHEMA_PATHS'].split():
data = pathlib.Path(path).read_bytes()
meta = json.loads(data)['x-bettersync']
if meta['format'] != 1 or not re.fullmatch(r'[a-z0-9-]+', meta['plugin']) or not re.fullmatch(r'[A-Za-z0-9._-]+', meta['schemaVersion']):
raise ValueError('Invalid schema identity')
pathlib.Path('release-assets', f"{meta['plugin']}-{meta['schemaVersion']}.schema.json").write_bytes(data)
PYTHON
- name: Publish versioned release
if: steps.existing.outputs.exists != 'true'
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ steps.version.outputs.tag }}
RELEASE_TITLE: ${{ steps.version.outputs.title }}
run: |
gh release create "$RELEASE_TAG" release-assets/* \
--target "$GITHUB_SHA" --title "$RELEASE_TITLE" --generate-notes --latest
+1 -1
View File
@@ -18,4 +18,4 @@ jobs:
run: cp settings.xml $HOME/.m2/settings.xml
- name: Build and test with Maven
run: mvn test
run: mvn -B -pl :BetterRTP test