fix: replace jprm repo add with custom manifest script, fix release upload
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4d777a10ff
commit
505747ccc9
|
|
@ -72,9 +72,6 @@ jobs:
|
|||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Install jprm
|
||||
run: pip install jprm --break-system-packages
|
||||
|
||||
- name: Rename artifacts
|
||||
run: |
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
|
|
@ -83,10 +80,65 @@ jobs:
|
|||
|
||||
- name: Update manifest.json
|
||||
run: |
|
||||
jprm repo add \
|
||||
--url="${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/" \
|
||||
. \
|
||||
artifacts/**/*.zip
|
||||
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: |
|
||||
|
|
@ -102,6 +154,7 @@ jobs:
|
|||
REPO="${{ github.repository }}"
|
||||
TAG="${{ github.ref_name }}"
|
||||
TOKEN="${{ secrets.GITHUB_TOKEN }}"
|
||||
VER="${GITHUB_REF_NAME#v}"
|
||||
|
||||
# Create release, fall back to existing if already present
|
||||
RELEASE=$(curl -s -X POST "${API}/repos/${REPO}/releases" \
|
||||
|
|
@ -117,10 +170,18 @@ jobs:
|
|||
echo "Release ID: ${RELEASE_ID}"
|
||||
|
||||
# Upload assets
|
||||
for file in artifacts/build-net9/*.zip artifacts/build-net10/*.zip; do
|
||||
for file in \
|
||||
"artifacts/build-net9/Jellyfin-AutoBackup-${VER}-10.11.x.zip" \
|
||||
"artifacts/build-net10/Jellyfin-AutoBackup-${VER}-12.0.x.zip"; do
|
||||
NAME=$(basename "${file}")
|
||||
curl -s -X POST "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${NAME}" \
|
||||
echo "Uploading ${NAME}..."
|
||||
HTTP_CODE=$(curl -s -o /tmp/upload_response.json -w "%{http_code}" \
|
||||
-X POST "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${NAME}" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${file}"
|
||||
--data-binary "@${file}")
|
||||
echo "HTTP ${HTTP_CODE}: $(cat /tmp/upload_response.json)"
|
||||
if [ "${HTTP_CODE}" != "201" ]; then
|
||||
echo "Failed to upload ${NAME}" && exit 1
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue