diff --git a/.gitea/workflows/release_automation.yml b/.gitea/workflows/release_automation.yml index b81a345..b8bbada 100644 --- a/.gitea/workflows/release_automation.yml +++ b/.gitea/workflows/release_automation.yml @@ -180,4 +180,79 @@ jobs: git push else echo "No changes to central manifest." + fi + + # Update Message in Seasonals Repository + - name: Checkout Seasonal Manifest Repo + uses: actions/checkout@v6 + with: + repository: ${{ github.repository_owner }}/jellyfin-plugin-manifest + path: seasonal-manifest + token: ${{ secrets.JELLYFIN_PLUGIN_MANIFEST_UPDATER_PAT }} + + - name: Update Central Manifest + shell: bash + run: | + cd seasonal-manifest + + # 1. Get info from previous steps + VERSION="${{ env.VERSION }}" + HASH="${{ env.ZIP_HASH }}" + TIME="${{ env.BUILD_TIME }}" + DOWNLOAD_URL="https://git.mahom03-spacecloud.de/${{ github.repository }}/releases/download/v$VERSION/Jellyfin.Plugin.MediaBarEnhanced.zip" + + # 2. Get info from env + PLUGIN_GUID="${{ env.PLUGIN_GUID }}" + CHANGELOG="${{ env.CHANGELOG }}" + TARGET_ABI="${{ env.TARGET_ABI }}" + + echo "Updating Seasonal Manifest for Plugin GUID: $PLUGIN_GUID" + + # 3. Update/Prepend entry in seasonal manifest.json + # Logic: + # - If array is empty or new version != old version: PREPEND new entry + # - If new version == old version: OVERWRITE (update) existing entry (re-release) + + jq --arg guid "$PLUGIN_GUID" \ + --arg hash "$HASH" \ + --arg time "$TIME" \ + --arg url "$DOWNLOAD_URL" \ + --arg ver "$VERSION" \ + --arg changelog "$CHANGELOG" \ + --arg abi "$TARGET_ABI" \ + 'map(if .guid == $guid then + if .versions[0].version != $ver then + # New Version -> Prepend + .versions = [{ + "version": $ver, + "changelog": $changelog, + "targetAbi": $abi, + "sourceUrl": $url, + "checksum": $hash, + "timestamp": $time + }] + .versions + else + # Same Version -> Update existing (overwrite top) + .versions[0].changelog = $changelog | + .versions[0].targetAbi = $abi | + .versions[0].sourceUrl = $url | + .versions[0].checksum = $hash | + .versions[0].timestamp = $time + end + else . end)' \ + manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json + + - name: Commit and Push Seasonal Manifest + run: | + cd seasonal-manifest + git config user.name "CodeDevMLH" + git config user.email "145071728+CodeDevMLH@users.noreply.github.com" + + # Check if there are changes + if [[ -n $(git status -s) ]]; then + git add manifest.json + git commit -m "Auto-Update MediaBar Enhanced to v${{ env.VERSION }}" + git push + else + echo "No changes to seasonal manifest." fi \ No newline at end of file diff --git a/.github/workflows/release_automation.yml b/.github/workflows/release_automation.yml index 467c9c3..30a1f5b 100644 --- a/.github/workflows/release_automation.yml +++ b/.github/workflows/release_automation.yml @@ -178,4 +178,79 @@ jobs: git push else echo "No changes to central manifest." + fi + + # Update Message in Seasonals Repository + - name: Checkout Seasonal Manifest Repo + uses: actions/checkout@v6 + with: + repository: ${{ github.repository_owner }}/jellyfin-plugin-manifest + path: seasonal-manifest + token: ${{ secrets.JELLYFIN_PLUGIN_MANIFEST_UPDATER_PAT }} + + - name: Update Central Manifest + shell: bash + run: | + cd seasonal-manifest + + # 1. Get info from previous steps + VERSION="${{ env.VERSION }}" + HASH="${{ env.ZIP_HASH }}" + TIME="${{ env.BUILD_TIME }}" + DOWNLOAD_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/v$VERSION/Jellyfin.Plugin.MediaBarEnhanced.zip" + + # 2. Get info from env + PLUGIN_GUID="${{ env.PLUGIN_GUID }}" + CHANGELOG="${{ env.CHANGELOG }}" + TARGET_ABI="${{ env.TARGET_ABI }}" + + echo "Updating Seasonal Manifest for Plugin GUID: $PLUGIN_GUID" + + # 3. Update/Prepend entry in seasonal manifest.json + # Logic: + # - If array is empty or new version != old version: PREPEND new entry + # - If new version == old version: OVERWRITE (update) existing entry (re-release) + + jq --arg guid "$PLUGIN_GUID" \ + --arg hash "$HASH" \ + --arg time "$TIME" \ + --arg url "$DOWNLOAD_URL" \ + --arg ver "$VERSION" \ + --arg changelog "$CHANGELOG" \ + --arg abi "$TARGET_ABI" \ + 'map(if .guid == $guid then + if .versions[0].version != $ver then + # New Version -> Prepend + .versions = [{ + "version": $ver, + "changelog": $changelog, + "targetAbi": $abi, + "sourceUrl": $url, + "checksum": $hash, + "timestamp": $time + }] + .versions + else + # Same Version -> Update existing (overwrite top) + .versions[0].changelog = $changelog | + .versions[0].targetAbi = $abi | + .versions[0].sourceUrl = $url | + .versions[0].checksum = $hash | + .versions[0].timestamp = $time + end + else . end)' \ + manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json + + - name: Commit and Push Seasonal Manifest + run: | + cd seasonal-manifest + git config user.name "CodeDevMLH" + git config user.email "145071728+CodeDevMLH@users.noreply.github.com" + + # Check if there are changes + if [[ -n $(git status -s) ]]; then + git add manifest.json + git commit -m "Auto-Update MediaBar Enhanced to v${{ env.VERSION }}" + git push + else + echo "No changes to seasonal manifest." fi \ No newline at end of file