refactor: local manifest update script, simplified CI to build+release only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Filtik 2026-07-03 00:08:00 +02:00
parent 010fdee711
commit 336be564d0
3 changed files with 91 additions and 77 deletions

View File

@ -71,8 +71,6 @@ jobs:
contents: write contents: write
steps: steps:
- uses: actions/checkout@v4
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@ -84,81 +82,6 @@ jobs:
mv artifacts/build-net9/*.zip "artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip" mv artifacts/build-net9/*.zip "artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip"
mv artifacts/build-net10/*.zip "artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip" mv artifacts/build-net10/*.zip "artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"
- name: Update manifest.json
run: |
VER="${GITHUB_REF_NAME#v}"
BASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}"
NET9_FILE="artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip"
NET10_FILE="artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
NET9_MD5=$(md5sum "${NET9_FILE}" | cut -d' ' -f1)
NET10_MD5=$(md5sum "${NET10_FILE}" | cut -d' ' -f1)
python3 - <<EOF
import json, sys
with open('manifest.json') as f:
manifest = json.load(f)
guid = '1175543c-6d20-4cfa-93a6-1476836df34c'
ver = '${VER}'
base_url = '${BASE_URL}'
timestamp = '${TIMESTAMP}'
net9_md5 = '${NET9_MD5}'
net10_md5 = '${NET10_MD5}'
plugin = next((p for p in manifest if p['guid'] == guid), None)
if not plugin:
plugin = {
'guid': guid,
'name': 'Auto Backup',
'description': 'Automated scheduled ZIP backups of Jellyfin data.',
'overview': 'Automated scheduled ZIP backups of Jellyfin data.',
'owner': 'Filtik',
'category': 'General',
'imageUrl': 'https://gitea.home.filtik.de/Filtik/Jellyfin-AutoBackup/raw/branch/main/images/logo.png',
'versions': []
}
manifest.append(plugin)
# Remove existing entries for this version
plugin['versions'] = [v for v in plugin['versions'] if v['version'] != ver]
plugin['versions'].insert(0, {
'version': ver,
'changelog': '',
'targetAbi': '12.0.0.0',
'sourceUrl': f'{base_url}/Jellyfin-AutoBackup-{ver}-12.0.x.zip',
'checksum': net10_md5,
'timestamp': timestamp
})
plugin['versions'].insert(0, {
'version': ver,
'changelog': '',
'targetAbi': '10.11.0.0',
'sourceUrl': f'{base_url}/Jellyfin-AutoBackup-{ver}-10.11.x.zip',
'checksum': net9_md5,
'timestamp': timestamp
})
with open('manifest.json', 'w') as f:
json.dump(manifest, f, indent=4)
print('manifest.json updated')
EOF
- name: Commit manifest.json
run: |
git config user.name "gitea-actions"
git config user.email "actions@noreply.local"
cp manifest.json /tmp/manifest_updated.json
git fetch origin main
git checkout -f main
git pull --rebase origin main
cp /tmp/manifest_updated.json manifest.json
git add manifest.json
git diff --staged --quiet || git commit -m "chore: update manifest for ${{ github.ref_name }}"
git push origin main
- name: Create release and upload assets - name: Create release and upload assets
run: | run: |
API="${{ github.server_url }}/api/v1" API="${{ github.server_url }}/api/v1"

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
bin/ bin/
obj/ obj/
publish/ publish/
dist/
.vs/ .vs/
*.user *.user

90
update-manifest.ps1 Normal file
View File

@ -0,0 +1,90 @@
param(
[Parameter(Mandatory)][string]$Version
)
$ErrorActionPreference = 'Stop'
$ProjectDir = $PSScriptRoot
$Tag = "v$Version"
$BaseUrl = "https://gitea.home.filtik.de/Filtik/Jellyfin-AutoBackup/releases/download/$Tag"
$OutputDir = Join-Path $ProjectDir "dist"
$Guid = '1175543c-6d20-4cfa-93a6-1476836df34c'
$ManifestPath = Join-Path $ProjectDir "manifest.json"
# Clean output dir
if (Test-Path $OutputDir) { Remove-Item $OutputDir -Recurse -Force }
New-Item $OutputDir -ItemType Directory | Out-Null
# Build net9.0 (Jellyfin 10.x)
Write-Host "Building net9.0..."
dotnet publish "$ProjectDir/AutoBackup.csproj" -f net9.0 -c Release -o "$OutputDir/net9" --nologo -v q
# Build net10.0 (Jellyfin 12.x)
Write-Host "Building net10.0..."
dotnet publish "$ProjectDir/AutoBackup.csproj" -f net10.0 -c Release -o "$OutputDir/net10" --nologo -v q
# Create ZIPs (only the DLL)
$Net9Zip = "$OutputDir\Jellyfin-AutoBackup-$Version-10.11.x.zip"
$Net10Zip = "$OutputDir\Jellyfin-AutoBackup-$Version-12.0.x.zip"
Compress-Archive -Path "$OutputDir\net9\Jellyfin.Plugin.AutoBackup.dll" -DestinationPath $Net9Zip
Compress-Archive -Path "$OutputDir\net10\Jellyfin.Plugin.AutoBackup.dll" -DestinationPath $Net10Zip
Write-Host "ZIPs created:"
Write-Host " $Net9Zip"
Write-Host " $Net10Zip"
# Compute MD5 checksums
$Net9Md5 = (Get-FileHash $Net9Zip -Algorithm MD5).Hash.ToLower()
$Net10Md5 = (Get-FileHash $Net10Zip -Algorithm MD5).Hash.ToLower()
# Update manifest.json
$Timestamp = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
$manifest = Get-Content $ManifestPath -Raw | ConvertFrom-Json
$plugin = $manifest | Where-Object { $_.guid -eq $Guid }
if (-not $plugin) {
$plugin = [PSCustomObject]@{
guid = $Guid
name = 'Auto Backup'
description = 'Automated scheduled ZIP backups of Jellyfin data.'
overview = 'Automated scheduled ZIP backups of Jellyfin data.'
owner = 'Filtik'
category = 'General'
imageUrl = 'https://gitea.home.filtik.de/Filtik/Jellyfin-AutoBackup/raw/branch/main/images/logo.png'
versions = @()
}
$manifest = @($plugin)
}
# Remove existing entries for this version
$plugin.versions = @($plugin.versions | Where-Object { $_.version -ne $Version })
# Prepend new entries (net9 first, net10 second)
$plugin.versions = @(
[PSCustomObject]@{
version = $Version
changelog = ''
targetAbi = '10.11.0.0'
sourceUrl = "$BaseUrl/Jellyfin-AutoBackup-$Version-10.11.x.zip"
checksum = $Net9Md5
timestamp = $Timestamp
},
[PSCustomObject]@{
version = $Version
changelog = ''
targetAbi = '12.0.0.0'
sourceUrl = "$BaseUrl/Jellyfin-AutoBackup-$Version-12.0.x.zip"
checksum = $Net10Md5
timestamp = $Timestamp
}
) + $plugin.versions
[System.IO.File]::WriteAllText($ManifestPath, ($manifest | ConvertTo-Json -Depth 10))
Write-Host "manifest.json updated."
Write-Host ""
Write-Host "Next steps:"
Write-Host " 1. git add manifest.json && git commit -m 'chore: update manifest for $Tag'"
Write-Host " 2. git push"
Write-Host " 3. git tag $Tag && git push origin $Tag"