mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
Compare commits
1 Commits
9acabca40e
...
fix-logbac
| Author | SHA1 | Date | |
|---|---|---|---|
| 9398581aa4 |
36
.github/workflows/sync-from-gitea.yml
vendored
Normal file
36
.github/workflows/sync-from-gitea.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Sync from Gitea
|
||||||
|
|
||||||
|
# 1. 给 GITHUB_TOKEN 开写权限
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '*/30 * * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 配置 Git 用户
|
||||||
|
run: |
|
||||||
|
git config --global user.name "Gitea Sync Bot"
|
||||||
|
git config --global user.email "slhafzjw@slhaf.work"
|
||||||
|
|
||||||
|
- name: 关闭全局 SSL 校验
|
||||||
|
run: git config --global http.sslVerify false
|
||||||
|
|
||||||
|
- name: Clone from Gitea (mirror)
|
||||||
|
run: |
|
||||||
|
git clone --mirror \
|
||||||
|
https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_TOKEN }}@${{ secrets.GITEA_URL }} \
|
||||||
|
gitea-mirror
|
||||||
|
|
||||||
|
- name: Push to GitHub
|
||||||
|
run: |
|
||||||
|
cd gitea-mirror
|
||||||
|
# 明确推到名为 "github" 的 remote
|
||||||
|
git remote add github \
|
||||||
|
https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||||
|
git push --mirror github
|
||||||
70
.github/workflows/update-latest-buildable.yml
vendored
70
.github/workflows/update-latest-buildable.yml
vendored
@@ -1,70 +0,0 @@
|
|||||||
name: Update latest buildable
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
ref:
|
|
||||||
description: "Buildable ref, for example buildable/v0.5.0"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "buildable/*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-latest-buildable:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Resolve buildable ref
|
|
||||||
id: buildable
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
echo "ref=${{ inputs.ref }}" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "ref=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Checkout master
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: master
|
|
||||||
|
|
||||||
- name: Update latestBuildable
|
|
||||||
run: |
|
|
||||||
python3 - <<'PY'
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
ref = "${{ steps.buildable.outputs.ref }}"
|
|
||||||
index_path = Path("registry/index.json")
|
|
||||||
|
|
||||||
index = json.loads(index_path.read_text(encoding="utf-8"))
|
|
||||||
|
|
||||||
index["partner"]["latestBuildable"] = {
|
|
||||||
"url": "https://github.com/slhaf/Partner.git",
|
|
||||||
"ref": ref
|
|
||||||
}
|
|
||||||
|
|
||||||
index_path.write_text(
|
|
||||||
json.dumps(index, ensure_ascii=False, indent=2) + "\n",
|
|
||||||
encoding="utf-8"
|
|
||||||
)
|
|
||||||
PY
|
|
||||||
|
|
||||||
- name: Commit registry update
|
|
||||||
run: |
|
|
||||||
if git diff --quiet registry/index.json; then
|
|
||||||
echo "No latestBuildable changes."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
|
|
||||||
git add registry/index.json
|
|
||||||
git commit -m "chore(registry): update latest buildable to ${{ steps.buildable.outputs.ref }}"
|
|
||||||
git push
|
|
||||||
38
.github/workflows/update-module-index.yml
vendored
38
.github/workflows/update-module-index.yml
vendored
@@ -1,38 +0,0 @@
|
|||||||
name: update-module-index.yml
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths:
|
|
||||||
- "registry/modules/*.json"
|
|
||||||
- "registry/index.json"
|
|
||||||
- "scripts/update_module_index.py"
|
|
||||||
- "update-module-index.yml"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-registry-index:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Update module index
|
|
||||||
run: python3 scripts/update_module_index.py
|
|
||||||
|
|
||||||
- name: Commit updated index
|
|
||||||
run: |
|
|
||||||
if git diff --quiet registry/index.json; then
|
|
||||||
echo "No module index changes"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
|
|
||||||
git add registry/index.json
|
|
||||||
git commit -m "chore: update registry index"
|
|
||||||
git push
|
|
||||||
@@ -36,7 +36,6 @@ data class ModuleManifest(
|
|||||||
/** Human-readable module description shown before installation. */
|
/** Human-readable module description shown before installation. */
|
||||||
val description: String = "",
|
val description: String = "",
|
||||||
|
|
||||||
val version: String,
|
|
||||||
val source: Source,
|
val source: Source,
|
||||||
val install: Install,
|
val install: Install,
|
||||||
val config: Config? = null,
|
val config: Config? = null,
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"partner": {
|
|
||||||
"latestBuildable": {
|
|
||||||
"url": "https://github.com/slhaf/Partner.git",
|
|
||||||
"ref": "buildable/0.5.0"
|
|
||||||
},
|
|
||||||
"latestRelease": {
|
|
||||||
"url": "url",
|
|
||||||
"version": "0.5.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"externalModules": [
|
|
||||||
{
|
|
||||||
"name": "OneBot Adapter",
|
|
||||||
"version": "0.5.0",
|
|
||||||
"withGateway": true,
|
|
||||||
"registryRef": "modules/onebot-adapter.json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "onebot_channel",
|
|
||||||
"name": "OneBot Adapter",
|
|
||||||
"version": "0.5.0",
|
|
||||||
"withGateway": true,
|
|
||||||
"description": "OneBot v11 reverse WebSocket gateway adapter for Partner. It accepts reverse WebSocket connections from a OneBot implementation and converts private message events into Partner input events.",
|
|
||||||
"source": {
|
|
||||||
"url": "https://github.com/slhaf/Partner.git",
|
|
||||||
"sourceDirName": "Partner",
|
|
||||||
"buildCommand": [
|
|
||||||
"mvn",
|
|
||||||
"-B",
|
|
||||||
"-DskipTests=true",
|
|
||||||
"-pl",
|
|
||||||
"Partner-External-Modules/Partner-Onebot-Adapter",
|
|
||||||
"-am",
|
|
||||||
"package"
|
|
||||||
],
|
|
||||||
"artifactDirectory": "Partner-External-Modules/Partner-Onebot-Adapter/target",
|
|
||||||
"artifactPattern": "partner-onebot-adapter-*.jar"
|
|
||||||
},
|
|
||||||
"install": {
|
|
||||||
"target": "resources/module/partner-onebot-adapter.jar"
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"target": "config/gateway.json",
|
|
||||||
"fields": [
|
|
||||||
{
|
|
||||||
"name": "port",
|
|
||||||
"label": "OneBot reverse WebSocket server port",
|
|
||||||
"type": "INT",
|
|
||||||
"default": "29700",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "hostname",
|
|
||||||
"label": "OneBot reverse WebSocket server hostname",
|
|
||||||
"type": "STRING",
|
|
||||||
"default": "127.0.0.1",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"label": "OneBot reverse WebSocket path",
|
|
||||||
"type": "STRING",
|
|
||||||
"default": "/onebot/v11/ws",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "token",
|
|
||||||
"label": "OneBot access token",
|
|
||||||
"type": "STRING",
|
|
||||||
"default": "",
|
|
||||||
"required": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
|
||||||
INDEX_PATH = ROOT / "registry" / "index.json"
|
|
||||||
MODULES_DIR = ROOT / "registry" / "modules"
|
|
||||||
|
|
||||||
|
|
||||||
def load_json(path: Path) -> dict:
|
|
||||||
with path.open("r", encoding="utf-8") as f:
|
|
||||||
return json.load(f)
|
|
||||||
|
|
||||||
|
|
||||||
def write_json(path: Path, data: dict) -> None:
|
|
||||||
path.write_text(
|
|
||||||
json.dumps(data, ensure_ascii=False, indent=2) + "\n",
|
|
||||||
encoding="utf-8",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def build_external_modules() -> list[dict]:
|
|
||||||
entries = []
|
|
||||||
|
|
||||||
if not MODULES_DIR.exists():
|
|
||||||
return entries
|
|
||||||
|
|
||||||
for manifest_path in sorted(MODULES_DIR.glob("*.json")):
|
|
||||||
manifest = load_json(manifest_path)
|
|
||||||
|
|
||||||
# 这里按你当前 ModuleManifest 的完整文件结构取字段。
|
|
||||||
# version 如果 manifest 里暂时没有,可以先默认取 "0.5.0" 或直接要求 manifest 必须有。
|
|
||||||
name = manifest["name"]
|
|
||||||
version = manifest["version"]
|
|
||||||
with_gateway = manifest.get("withGateway", False)
|
|
||||||
|
|
||||||
rel_path = manifest_path.relative_to(ROOT / "registry").as_posix()
|
|
||||||
|
|
||||||
entries.append(
|
|
||||||
{
|
|
||||||
"name": name,
|
|
||||||
"version": version,
|
|
||||||
"withGateway": with_gateway,
|
|
||||||
"registryRef": rel_path,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return entries
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
index = load_json(INDEX_PATH)
|
|
||||||
index["externalModules"] = build_external_modules()
|
|
||||||
write_json(INDEX_PATH, index)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user