mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
Compare commits
1 Commits
68589a21fc
...
fix-logbac
| Author | SHA1 | Date | |
|---|---|---|---|
| 9398581aa4 |
137
.github/workflows/release-core.yml
vendored
137
.github/workflows/release-core.yml
vendored
@@ -1,137 +0,0 @@
|
|||||||
name: Release Partner Core
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Core release tag, for example release-core/0.5.0"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "release-core/*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release-core:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Resolve release metadata
|
|
||||||
id: release
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
TAG="${{ inputs.tag }}"
|
|
||||||
else
|
|
||||||
TAG="${GITHUB_REF_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION="${TAG#release-core/}"
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
ENCODED_TAG="${TAG//\//%2F}"
|
|
||||||
ASSET_NAME="partner-core-${VERSION}.jar"
|
|
||||||
ASSET_URL="https://github.com/slhaf/Partner/releases/download/${ENCODED_TAG}/${ASSET_NAME}"
|
|
||||||
|
|
||||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "asset_url=${ASSET_URL}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
echo "Core release tag: ${TAG}"
|
|
||||||
echo "Core release version: ${VERSION}"
|
|
||||||
echo "Core release asset: ${ASSET_NAME}"
|
|
||||||
|
|
||||||
- name: Checkout release source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ steps.release.outputs.tag }}
|
|
||||||
|
|
||||||
- name: Set up Java 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: "21"
|
|
||||||
|
|
||||||
- name: Build Partner Core
|
|
||||||
run: |
|
|
||||||
mvn -B -DskipTests=true -pl Partner-Core -am package
|
|
||||||
|
|
||||||
- name: Prepare release artifact
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
|
|
||||||
SOURCE_JAR="Partner-Core/target/partner-core-${{ steps.release.outputs.version }}.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$SOURCE_JAR" ]; then
|
|
||||||
echo "Expected artifact not found: $SOURCE_JAR"
|
|
||||||
echo "Available Partner-Core target files:"
|
|
||||||
find Partner-Core/target -maxdepth 1 -type f -name "*.jar" -print
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "$SOURCE_JAR" "dist/${{ steps.release.outputs.asset_name }}"
|
|
||||||
ls -lh dist
|
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
|
||||||
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
gh release create "${{ steps.release.outputs.tag }}" \
|
|
||||||
"dist/${{ steps.release.outputs.asset_name }}" \
|
|
||||||
--title "Partner Core ${{ steps.release.outputs.version }}" \
|
|
||||||
--notes "Partner Core ${{ steps.release.outputs.version }}"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Checkout master for registry update
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: master
|
|
||||||
path: registry-worktree
|
|
||||||
|
|
||||||
- name: Update latestRelease
|
|
||||||
working-directory: registry-worktree
|
|
||||||
run: |
|
|
||||||
python3 - <<'PY'
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
version = "${{ steps.release.outputs.version }}"
|
|
||||||
url = "${{ steps.release.outputs.asset_url }}"
|
|
||||||
|
|
||||||
index_path = Path("registry/index.json")
|
|
||||||
index = json.loads(index_path.read_text(encoding="utf-8"))
|
|
||||||
|
|
||||||
index["partner"]["latestRelease"] = {
|
|
||||||
"url": url,
|
|
||||||
"version": version
|
|
||||||
}
|
|
||||||
|
|
||||||
index_path.write_text(
|
|
||||||
json.dumps(index, ensure_ascii=False, indent=2) + "\n",
|
|
||||||
encoding="utf-8"
|
|
||||||
)
|
|
||||||
PY
|
|
||||||
|
|
||||||
- name: Commit registry update
|
|
||||||
working-directory: registry-worktree
|
|
||||||
run: |
|
|
||||||
if git diff --quiet registry/index.json; then
|
|
||||||
echo "No latestRelease 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 core release to ${{ steps.release.outputs.tag }}"
|
|
||||||
git push origin HEAD:master
|
|
||||||
156
.github/workflows/release-ctl.yml
vendored
156
.github/workflows/release-ctl.yml
vendored
@@ -1,156 +0,0 @@
|
|||||||
name: Release PartnerCtl
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Ctl release tag, for example release-ctl/0.5.0"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "release-ctl/*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build ${{ matrix.platform }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- platform: linux-x64
|
|
||||||
runner: ubuntu-latest
|
|
||||||
binaryPath: PartnerCtl/target/partnerctl
|
|
||||||
assetSuffix: linux-x64
|
|
||||||
- platform: linux-arm64
|
|
||||||
runner: ubuntu-24.04-arm
|
|
||||||
binaryPath: PartnerCtl/target/partnerctl
|
|
||||||
assetSuffix: linux-arm64
|
|
||||||
- platform: windows-x64
|
|
||||||
runner: windows-latest
|
|
||||||
binaryPath: PartnerCtl/target/partnerctl.exe
|
|
||||||
assetSuffix: windows-x64.exe
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Resolve release metadata
|
|
||||||
id: release
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
TAG="${{ inputs.tag }}"
|
|
||||||
else
|
|
||||||
TAG="${GITHUB_REF_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION="${TAG#release-ctl/}"
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
ASSET_NAME="partnerctl-${VERSION}-${{ matrix.assetSuffix }}"
|
|
||||||
|
|
||||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
echo "Ctl release tag: ${TAG}"
|
|
||||||
echo "Ctl release version: ${VERSION}"
|
|
||||||
echo "Ctl release asset: ${ASSET_NAME}"
|
|
||||||
|
|
||||||
- name: Checkout release source
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ steps.release.outputs.tag }}
|
|
||||||
|
|
||||||
- name: Set up GraalVM 21
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
distribution: graalvm-community
|
|
||||||
java-version: "21"
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Build partnerctl native image
|
|
||||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
|
||||||
|
|
||||||
- name: Prepare release artifact
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
|
|
||||||
BINARY_PATH="${{ matrix.binaryPath }}"
|
|
||||||
ASSET_PATH="dist/${{ steps.release.outputs.asset_name }}"
|
|
||||||
|
|
||||||
if [ ! -f "$BINARY_PATH" ]; then
|
|
||||||
echo "Expected native binary not found: $BINARY_PATH"
|
|
||||||
echo "Available PartnerCtl target files:"
|
|
||||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "$BINARY_PATH" "$ASSET_PATH"
|
|
||||||
|
|
||||||
if [[ "${{ matrix.platform }}" == linux-* ]]; then
|
|
||||||
chmod +x "$ASSET_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ls -lh dist
|
|
||||||
|
|
||||||
- name: Upload release artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ steps.release.outputs.asset_name }}
|
|
||||||
path: dist/${{ steps.release.outputs.asset_name }}
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Create GitHub Release
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Resolve release metadata
|
|
||||||
id: release
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
||||||
TAG="${{ inputs.tag }}"
|
|
||||||
else
|
|
||||||
TAG="${GITHUB_REF_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION="${TAG#release-ctl/}"
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
|
|
||||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
echo "Ctl release tag: ${TAG}"
|
|
||||||
echo "Ctl release version: ${VERSION}"
|
|
||||||
|
|
||||||
- name: Download release artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: dist
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Show release artifacts
|
|
||||||
run: |
|
|
||||||
ls -lh dist
|
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
|
||||||
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
gh release create "${{ steps.release.outputs.tag }}" \
|
|
||||||
dist/* \
|
|
||||||
--title "PartnerCtl ${{ steps.release.outputs.version }}" \
|
|
||||||
--notes "PartnerCtl ${{ steps.release.outputs.version }}"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
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
|
||||||
137
.github/workflows/test-partnerctl-native.yml
vendored
137
.github/workflows/test-partnerctl-native.yml
vendored
@@ -1,137 +0,0 @@
|
|||||||
name: Test PartnerCtl Native Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
platform:
|
|
||||||
description: "Target platform to test"
|
|
||||||
required: true
|
|
||||||
default: "windows-x64"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- windows-x64
|
|
||||||
- linux-x64
|
|
||||||
- linux-arm64
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-linux-x64:
|
|
||||||
name: Test linux-x64
|
|
||||||
if: ${{ inputs.platform == 'linux-x64' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up GraalVM 21
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
distribution: graalvm-community
|
|
||||||
java-version: "21"
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Build partnerctl native image
|
|
||||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
|
||||||
|
|
||||||
- name: Check Linux output
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
|
||||||
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
|
||||||
echo "Available PartnerCtl target files:"
|
|
||||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod +x PartnerCtl/target/partnerctl
|
|
||||||
./PartnerCtl/target/partnerctl --help
|
|
||||||
|
|
||||||
- name: Upload test artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: partnerctl-linux-x64-test
|
|
||||||
path: PartnerCtl/target/partnerctl
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
test-linux-arm64:
|
|
||||||
name: Test linux-arm64
|
|
||||||
if: ${{ inputs.platform == 'linux-arm64' }}
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up GraalVM 21
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
distribution: graalvm-community
|
|
||||||
java-version: "21"
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Build partnerctl native image
|
|
||||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
|
||||||
|
|
||||||
- name: Check Linux output
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
|
||||||
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
|
||||||
echo "Available PartnerCtl target files:"
|
|
||||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod +x PartnerCtl/target/partnerctl
|
|
||||||
./PartnerCtl/target/partnerctl --help
|
|
||||||
|
|
||||||
- name: Upload test artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: partnerctl-linux-arm64-test
|
|
||||||
path: PartnerCtl/target/partnerctl
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
test-windows-x64:
|
|
||||||
name: Test windows-x64
|
|
||||||
if: ${{ inputs.platform == 'windows-x64' }}
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up GraalVM 21
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
distribution: graalvm-community
|
|
||||||
java-version: "21"
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Build partnerctl native image
|
|
||||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
|
||||||
|
|
||||||
- name: Check Windows output
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
if (!(Test-Path "PartnerCtl/target/partnerctl.exe")) {
|
|
||||||
Write-Host "Expected native binary not found: PartnerCtl/target/partnerctl.exe"
|
|
||||||
Write-Host "Available PartnerCtl target files:"
|
|
||||||
Get-ChildItem -Recurse PartnerCtl/target | Select-Object FullName
|
|
||||||
throw "partnerctl.exe not found"
|
|
||||||
}
|
|
||||||
|
|
||||||
.\PartnerCtl\target\partnerctl.exe --help
|
|
||||||
|
|
||||||
- name: Upload test artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: partnerctl-windows-x64-test
|
|
||||||
path: PartnerCtl/target/partnerctl.exe
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
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
|
|
||||||
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": "https://github.com/slhaf/Partner/releases/download/release-core%2F0.5.0/partner-core-0.5.0.jar",
|
|
||||||
"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