Files
jellypod/.gitea/workflows/release.yaml
T
dtourolleandClaude Opus 5 c67005bd8f
🏗️ Build Plugin / build (push) Successful in 2m9s
🚀 Release Plugin / build-and-release (push) Successful in 1m33s
Add Jellyfin 12.0 build target alongside 10.9
The plugin now multi-targets net8.0 (Jellyfin 10.9, ABI 10.9.0.0) and net10.0
(Jellyfin 12.0, ABI 12.0.0.0) from one source tree, and each release ships both
packages.

TaskTriggerInfo.Type became a TaskTriggerInfoType enum in 12.0, which is the
only source-level break; it is handled with a NET10_0_OR_GREATER switch. CA1873
is disabled in the ruleset alongside CA1848, which it supersedes.

build.yaml stays the 10.9 config and the 12.0 one is derived from it at build
time, so the two cannot drift apart. Both manifest entries are prepended per
release with the 12.0 one first: Jellyfin keeps entries whose targetAbi is <=
the server version and takes the first of the highest version, so a 12.0 server
picks the 12.0 build while a 10.9 server never sees it.

The builder image now carries the .NET 10 SDK with the .NET 8 SDK alongside it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 18:51:45 +02:00

188 lines
7.9 KiB
YAML

name: '🚀 Release Plugin'
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v1.0.0)'
required: true
type: string
jobs:
build-and-release:
runs-on: ubuntu-22.04
container:
image: gitea.tourolle.paris/dtourolle/jellypod-builder:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION}"
- name: Update build.yaml with version
run: |
VERSION="${{ steps.get_version.outputs.version_number }}"
sed -i "s/^version:.*/version: \"${VERSION}\"/" build.yaml
cat build.yaml
- name: Generate Jellyfin 12.0 build config
run: |
# build.yaml is the Jellyfin 10.9 (net8.0) config; derive the
# Jellyfin 12.0 (net10.0) one from it so the two cannot drift apart.
sed \
-e 's/^targetAbi:.*/targetAbi: "12.0.0.0"/' \
-e 's/^framework:.*/framework: "net10.0"/' \
-e 's/^dotnet_framework:.*/dotnet_framework: "net10.0"/' \
build.yaml > build.jf12.yaml
cat build.jf12.yaml
- name: Restore dependencies
run: dotnet restore Jellyfin.Plugin.Jellypod.sln
- name: Build solution
run: dotnet build Jellyfin.Plugin.Jellypod.sln --configuration Release --no-restore --no-self-contained
- name: Run tests
run: dotnet test Jellyfin.Plugin.Jellypod.sln --no-build --configuration Release --verbosity normal
- name: Build plugin for Jellyfin 10.9 (net8.0)
id: jprm_jf109
run: |
mkdir -p ./artifacts/jf10.9
jprm --verbosity=debug plugin build . --output ./artifacts/jf10.9
ARTIFACT=$(find ./artifacts/jf10.9 -name "*.zip" -type f -print -quit)
RENAMED="./artifacts/jf10.9/$(basename "${ARTIFACT}" .zip)_jf10.9.zip"
mv "${ARTIFACT}" "${RENAMED}"
echo "artifact=${RENAMED}" >> $GITHUB_OUTPUT
echo "artifact_name=$(basename "${RENAMED}")" >> $GITHUB_OUTPUT
echo "checksum=$(md5sum "${RENAMED}" | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "Found artifact: ${RENAMED}"
- name: Build plugin for Jellyfin 12.0 (net10.0)
id: jprm_jf12
run: |
# jprm always reads build.yaml, so swap the 12.0 config in for this build.
cp build.yaml build.jf10.9.yaml
cp build.jf12.yaml build.yaml
mkdir -p ./artifacts/jf12
jprm --verbosity=debug plugin build . --output ./artifacts/jf12
mv build.jf10.9.yaml build.yaml
ARTIFACT=$(find ./artifacts/jf12 -name "*.zip" -type f -print -quit)
RENAMED="./artifacts/jf12/$(basename "${ARTIFACT}" .zip)_jf12.zip"
mv "${ARTIFACT}" "${RENAMED}"
echo "artifact=${RENAMED}" >> $GITHUB_OUTPUT
echo "artifact_name=$(basename "${RENAMED}")" >> $GITHUB_OUTPUT
echo "checksum=$(md5sum "${RENAMED}" | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "Found artifact: ${RENAMED}"
- name: Create Release
id: create_release
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get repository information
REPO_OWNER="${{ github.repository_owner }}"
REPO_NAME="${{ github.event.repository.name }}"
GITEA_URL="${{ github.server_url }}"
# Create release using Gitea API
VERSION="${{ steps.get_version.outputs.version }}"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases" \
-d "$(jq -n --arg tag "$VERSION" --arg name "Release $VERSION" --arg body "Jellypod Jellyfin Plugin. Install the _jf10.9 build on Jellyfin 10.9.x and the _jf12 build on Jellyfin 12.0 or newer." '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
RELEASE_ID=$(echo "$BODY" | jq -r '.id')
echo "release_id=${RELEASE_ID}" >> $GITHUB_OUTPUT
echo "Created release with ID: ${RELEASE_ID}"
else
echo "Failed to create release. HTTP ${HTTP_CODE}"
echo "$BODY"
exit 1
fi
upload_asset() {
echo "Uploading $2 ..."
curl -f -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: $3" \
--data-binary "@$1" \
"${GITEA_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets?name=$2"
}
upload_asset "${{ steps.jprm_jf109.outputs.artifact }}" "${{ steps.jprm_jf109.outputs.artifact_name }}" "application/zip"
upload_asset "${{ steps.jprm_jf12.outputs.artifact }}" "${{ steps.jprm_jf12.outputs.artifact_name }}" "application/zip"
upload_asset build.yaml build.yaml "application/x-yaml"
upload_asset build.jf12.yaml build.jf12.yaml "application/x-yaml"
echo "Release created successfully!"
echo "View at: ${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/tag/${{ steps.get_version.outputs.version }}"
- name: Update manifest.json
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
REPO_OWNER="${{ github.repository_owner }}"
REPO_NAME="${{ github.event.repository.name }}"
GITEA_URL="${{ github.server_url }}"
VERSION="${{ steps.get_version.outputs.version_number }}"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
RELEASE_URL="${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/download/${{ steps.get_version.outputs.version }}"
# Configure git
git config user.name "Gitea Actions"
git config user.email "actions@gitea.tourolle.paris"
# Fetch and checkout master branch
git fetch origin master
git checkout master
# Prepend both ABI entries for this version. Jellyfin keeps only the
# entries whose targetAbi is <= the server version and then takes the
# first of the highest version, so the 12.0 entry must come first: a
# 12.0 server sees both and picks it, a 10.9 server never sees it.
jq --arg ver "${VERSION}" \
--arg changelog "Release ${VERSION}" \
--arg abi12 "12.0.0.0" \
--arg url12 "${RELEASE_URL}/${{ steps.jprm_jf12.outputs.artifact_name }}" \
--arg checksum12 "${{ steps.jprm_jf12.outputs.checksum }}" \
--arg abi109 "10.9.0.0" \
--arg url109 "${RELEASE_URL}/${{ steps.jprm_jf109.outputs.artifact_name }}" \
--arg checksum109 "${{ steps.jprm_jf109.outputs.checksum }}" \
--arg ts "${TIMESTAMP}" \
'.[0].versions = [
{version: $ver, changelog: $changelog, targetAbi: $abi12, sourceUrl: $url12, checksum: $checksum12, timestamp: $ts},
{version: $ver, changelog: $changelog, targetAbi: $abi109, sourceUrl: $url109, checksum: $checksum109, timestamp: $ts}
] + .[0].versions' \
manifest.json > manifest.tmp && mv manifest.tmp manifest.json
# Commit and push
git add manifest.json
git commit -m "Update manifest.json for version ${VERSION}"
git push origin master
echo "Manifest updated successfully!"