91 lines
3.2 KiB
PowerShell
91 lines
3.2 KiB
PowerShell
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"
|