Remove outdated JPRM documentation and release automation workflow
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 50s
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 50s
This commit is contained in:
104
jprm.md
104
jprm.md
@@ -1,104 +0,0 @@
|
|||||||
# Using JPRM (Jellyfin Plugin Repository Manager)
|
|
||||||
|
|
||||||
Wenn du mehrere Plugins hast, ist es oft einfacher, den offiziellen **JPRM** (Jellyfin Plugin Repository Manager) zu nutzen. Anstatt dass jedes Plugin sich selbst in die Manifest-Datei "pusht" (wie in deinem aktuellen Script), "pullt" das zentrale Repo automatisch die neuesten Releases deiner Plugins.
|
|
||||||
|
|
||||||
## Wie es funktioniert
|
|
||||||
1. Du hast ein zentrales Repo (z.B. `jellyfin-plugin-manifest`).
|
|
||||||
2. Dort läuft ein Script (JPRM), das eine Liste von deinen Plugin-Repos durchgeht.
|
|
||||||
3. Es prüft, ob es neue Releases gibt.
|
|
||||||
4. Es baut die `manifest.json` komplett neu.
|
|
||||||
|
|
||||||
## Schritt 1: Das zentrale Repo vorbereiten
|
|
||||||
|
|
||||||
Erstelle ein neues Repo (oder nimm dein vorhandenes `jellyfin-plugin-manifest`) und erstelle eine Datei namens `config.json` (oder ähnlich), die deine Plugins auflistet.
|
|
||||||
|
|
||||||
Beispiel `manifest-config.json` für JPRM:
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"Url": "https://github.com/CodeDevMLH/Media-Bar-Plugin",
|
|
||||||
"Branch": "main",
|
|
||||||
"Package": "Jellyfin.Plugin.MediaBarEnhanced"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Url": "https://github.com/CodeDevMLH/Anderes-Plugin",
|
|
||||||
"Branch": "main",
|
|
||||||
"Package": "Jellyfin.Plugin.Anderes"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Schritt 2: Der GitHub Workflow (im zentralen Repo)
|
|
||||||
|
|
||||||
In deinem **zentralen Repo** erstellst du einen Workflow `.github/workflows/update-manifest.yaml`. Dieser läuft z.B. jede Nacht oder wenn du ihn manuell startest.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Generate Manifest
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0 * * *' # Täglich um Mitternacht
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- name: Install JPRM
|
|
||||||
run: pip install jprm
|
|
||||||
|
|
||||||
- name: Generate Manifest
|
|
||||||
run: |
|
|
||||||
# jprm repo init --help für mehr infos
|
|
||||||
# Hier ein einfaches Beispielkommando (die genauen Flags hängen von deiner Struktur ab)
|
|
||||||
jprm repo build --url https://github.com/CodeDevMLH/Media-Bar-Plugin .
|
|
||||||
|
|
||||||
# Alternativ: Nutze ein fertiges Action-Script oder schreibe ein kleines Python Script,
|
|
||||||
# das die config.json liest und jprm aufruft.
|
|
||||||
|
|
||||||
- name: Commit & Push
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
|
||||||
with:
|
|
||||||
commit_message: Update repository manifest
|
|
||||||
file_pattern: manifest.json
|
|
||||||
```
|
|
||||||
|
|
||||||
*Hinweis: Der offizielle JPRM ist sehr mächtig, aber manchmal etwas komplex in der Einrichtung für einfache Setups. Viele User nutzen stattdessen ein einfacheres Python-Script.*
|
|
||||||
|
|
||||||
## Alternative: Einfaches Python Script (Empfohlen für den Start)
|
|
||||||
Ein simples Script, das du in deinem zentralen Repo ablegst und im Action-Workflow ausführst:
|
|
||||||
|
|
||||||
```python
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
import hashlib
|
|
||||||
|
|
||||||
# Konfiguration
|
|
||||||
PLUGINS = [
|
|
||||||
{"user": "CodeDevMLH", "repo": "Media-Bar-Plugin", "guid": "..."}
|
|
||||||
]
|
|
||||||
|
|
||||||
FINAL_MANIFEST = []
|
|
||||||
|
|
||||||
for p in PLUGINS:
|
|
||||||
# 1. Hole Latest Release vpm GitHub API
|
|
||||||
resp = requests.get(f"https://api.github.com/repos/{p['user']}/{p['repo']}/releases/latest")
|
|
||||||
data = resp.json()
|
|
||||||
|
|
||||||
# 2. Lade assets herunter, berechne Hash
|
|
||||||
# 3. Baue JSON Objekt
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# Speichere final_manifest.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## Fazit
|
|
||||||
- **Push-Methode (Deine aktuelle Lösung):** Gut für den Anfang. Du hast sofort Kontrolle. Jedes Plugin "kümmert sich selbst".
|
|
||||||
- **Pull-Methode (JPRM):** Besser wenn du 5+ Plugins hast. Das zentrale Repo hat die Hoheit.
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
name: Auto Release Plugin
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- '.github/**'
|
|
||||||
- 'README.md'
|
|
||||||
- 'jellyfin.ruleset'
|
|
||||||
- '.gitignore'
|
|
||||||
- '.editorconfig'
|
|
||||||
- 'LICENSE'
|
|
||||||
- 'logo.png'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v5
|
|
||||||
with:
|
|
||||||
dotnet-version: '9.x'
|
|
||||||
|
|
||||||
- name: Read Version from Manifest
|
|
||||||
id: read_version
|
|
||||||
run: |
|
|
||||||
VERSION=$(jq -r '.[0].versions[0].version' manifest.json)
|
|
||||||
CHANGELOG=$(jq -r '.[0].versions[0].changelog' manifest.json)
|
|
||||||
TARGET_ABI=$(jq -r '.[0].versions[0].targetAbi' manifest.json)
|
|
||||||
|
|
||||||
echo "Detected Version: $VERSION"
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Escape newlines in changelog for GITHUB_ENV
|
|
||||||
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
|
|
||||||
echo "$CHANGELOG" >> $GITHUB_ENV
|
|
||||||
echo "EOF" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and Zip
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
# Inject version from manifest into the build
|
|
||||||
dotnet build Jellyfin.Plugin.MediaBarEnhanced/Jellyfin.Plugin.MediaBarEnhanced.csproj --configuration Release --output bin/Publish /p:Version=${{ env.VERSION }} /p:AssemblyVersion=${{ env.VERSION }}
|
|
||||||
|
|
||||||
cd bin/Publish
|
|
||||||
zip -r Jellyfin.Plugin.MediaBarEnhanced.zip *
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
# Calculate hash
|
|
||||||
HASH=$(md5sum bin/Publish/Jellyfin.Plugin.MediaBarEnhanced.zip | awk '{ print $1 }')
|
|
||||||
TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
||||||
|
|
||||||
# Export variables for next steps
|
|
||||||
echo "ZIP_HASH=$HASH" >> $GITHUB_ENV
|
|
||||||
echo "BUILD_TIME=$TIME" >> $GITHUB_ENV
|
|
||||||
echo "ZIP_PATH=bin/Publish/Jellyfin.Plugin.MediaBarEnhanced.zip" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Update Local manifest.json (Optional)
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
REPO_OWNER="${{ github.repository_owner }}"
|
|
||||||
REPO_NAME="${{ github.event.repository.name }}"
|
|
||||||
VERSION="${{ env.VERSION }}"
|
|
||||||
DOWNLOAD_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/v$VERSION/Jellyfin.Plugin.MediaBarEnhanced.zip"
|
|
||||||
|
|
||||||
echo "Updating local manifest.json with:"
|
|
||||||
echo "Hash: ${{ env.ZIP_HASH }}"
|
|
||||||
echo "Time: ${{ env.BUILD_TIME }}"
|
|
||||||
echo "Url: $DOWNLOAD_URL"
|
|
||||||
|
|
||||||
jq --arg hash "${{ env.ZIP_HASH }}" \
|
|
||||||
--arg time "${{ env.BUILD_TIME }}" \
|
|
||||||
--arg url "$DOWNLOAD_URL" \
|
|
||||||
'.[0].versions[0].checksum = $hash | .[0].versions[0].timestamp = $time | .[0].versions[0].sourceUrl = $url' \
|
|
||||||
manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json
|
|
||||||
|
|
||||||
- name: Commit Local manifest.json
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v7
|
|
||||||
with:
|
|
||||||
commit_message: "Update manifest.json for release v${{ env.VERSION }} [skip ci]"
|
|
||||||
file_pattern: manifest.json
|
|
||||||
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: "v${{ env.VERSION }}"
|
|
||||||
name: "v${{ env.VERSION }}"
|
|
||||||
# body: ${{ env.CHANGELOG }}
|
|
||||||
files: ${{ env.ZIP_PATH }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
generate_release_notes: true
|
|
||||||
|
|
||||||
# Update Message in Remote Repository
|
|
||||||
- name: Checkout Central Manifest Repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: ${{ github.repository_owner }}/jellyfin-plugin-manifest
|
|
||||||
path: central-manifest
|
|
||||||
token: ${{ secrets.CENTRAL_REPO_PAT }}
|
|
||||||
|
|
||||||
- name: Update Central Manifest
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd central-manifest
|
|
||||||
|
|
||||||
# 1. Get info from previous steps
|
|
||||||
VERSION="${{ env.VERSION }}"
|
|
||||||
HASH="${{ env.ZIP_HASH }}"
|
|
||||||
TIME="${{ env.BUILD_TIME }}"
|
|
||||||
# URL points to the RELEASE we just created in the CURRENT repo
|
|
||||||
DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/v$VERSION/Jellyfin.Plugin.MediaBarEnhanced.zip"
|
|
||||||
|
|
||||||
# 2. Extract GUID from the *built* artifact or the source manifest (in parent dir)
|
|
||||||
# We use the source manifest from the checkout in '..'
|
|
||||||
PLUGIN_GUID=$(jq -r '.[0].guid' ../manifest.json)
|
|
||||||
|
|
||||||
echo "Updating Central Manifest for Plugin GUID: $PLUGIN_GUID"
|
|
||||||
|
|
||||||
# 3. Update the specific plugin entry in the central manifest.json
|
|
||||||
# This logic finds the object with matching guid, and updates its first version entry.
|
|
||||||
jq --arg guid "$PLUGIN_GUID" \
|
|
||||||
--arg hash "$HASH" \
|
|
||||||
--arg time "$TIME" \
|
|
||||||
--arg url "$DOWNLOAD_URL" \
|
|
||||||
--arg ver "$VERSION" \
|
|
||||||
'map(if .guid == $guid then
|
|
||||||
.versions[0].version = $ver |
|
|
||||||
.versions[0].checksum = $hash |
|
|
||||||
.versions[0].timestamp = $time |
|
|
||||||
.versions[0].sourceUrl = $url
|
|
||||||
else . end)' \
|
|
||||||
manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json
|
|
||||||
|
|
||||||
- name: Commit and Push Central Manifest
|
|
||||||
run: |
|
|
||||||
cd central-manifest
|
|
||||||
git config user.name "GitHub Action"
|
|
||||||
git config user.email "action@github.com"
|
|
||||||
|
|
||||||
# Check if there are changes
|
|
||||||
if [[ -n $(git status -s) ]]; then
|
|
||||||
git add manifest.json
|
|
||||||
git commit -m "Update MediaBar Enhanced to v${{ env.VERSION }}"
|
|
||||||
git push
|
|
||||||
else
|
|
||||||
echo "No changes to central manifest."
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user