Files
JellyfinSyncPlus/.github/workflows/release.yml
T
seer 1052ac5fa5
Build Check / build (push) Successful in 21s
Fix release workflow's manifest-commit checkout and correct 0.3.0.0 checksum
The "Commit updated manifest to master" step left manifest.json dirty
(modified during the tag checkout by package-release.sh) and then tried to
git checkout master, which git correctly refused -- that's the CI failure
from the v0.3.0.0 tag push. Discard the working-tree manifest.json before
switching branches, matching the /tmp copy-then-restore pattern already used
for carrying the update across.

Also corrects the 0.3.0.0 manifest entry itself: it had been hand-edited
locally with 0.2.0.0's leftover checksum instead of the real zip's hash, and
had dropped the 0.2.0.0 history entry entirely instead of appending. Rebuilt
via update_manifest.py against origin/master's manifest.json using the
actual checksum of the already-uploaded v0.3.0.0 release asset.
2026-07-10 20:19:58 +02:00

92 lines
3.9 KiB
YAML

name: Release Plugin
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout tagged commit
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: https://github.com/actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: metadata
id: meta
run: |
echo REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $1}') >> $GITHUB_OUTPUT
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo VERSION=$(echo ${GITHUB_REF_NAME} | sed 's/^v//') >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
# Fetch the two private (non-NuGet) server assemblies our plugin needs a
# compile-time-only reference to -- see PLAN.md "Known friction / risks" and
# dev/extract-private-refs.sh, which this mirrors for CI instead of a local
# docker container.
- name: Fetch private SDK references
run: |
mkdir -p lib/jellyfin-10.11.6
docker create --name jf-extract linuxserver/jellyfin:10.11.6
docker cp jf-extract:/usr/lib/jellyfin/bin/Emby.Server.Implementations.dll lib/jellyfin-10.11.6/
docker rm jf-extract
- name: Build, package, update manifest
env:
VERSION: ${{ steps.meta.outputs.VERSION }}
SERVER_URL: ${{ github.server_url }}
REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }}
REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }}
run: dev/package-release.sh
- name: Create Gitea release and upload zip
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
SERVER_URL: ${{ github.server_url }}
REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }}
REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }}
VERSION: ${{ steps.meta.outputs.VERSION }}
TAG: ${{ github.ref_name }}
run: |
RELEASE_ID=$(curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":\"See build.yaml changelog / manifest.json for this version's notes.\"}" \
"${SERVER_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@release/JellyfinSyncPlus_${VERSION}.zip" \
"${SERVER_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/releases/${RELEASE_ID}/assets?name=JellyfinSyncPlus_${VERSION}.zip"
# manifest.json has to live at a stable URL on a normal branch (master) --
# that's the one URL admins add to Jellyfin once, and every future release
# just appends to it. The tag checkout above is detached HEAD, so switch to
# master to commit, carrying the just-updated manifest.json across.
- name: Commit updated manifest to master
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
SERVER_URL: ${{ github.server_url }}
REPO_OWNER: ${{ steps.meta.outputs.REPO_OWNER }}
REPO_NAME: ${{ steps.meta.outputs.REPO_NAME }}
VERSION: ${{ steps.meta.outputs.VERSION }}
run: |
cp manifest.json /tmp/manifest.json
git checkout -- manifest.json
git fetch origin master
git checkout master
cp /tmp/manifest.json manifest.json
git config user.name "gitea-actions"
git config user.email "actions@gitea.local"
git add manifest.json
git diff --cached --quiet && echo "No manifest changes to commit" && exit 0
git commit -m "Release ${VERSION}"
HOST=$(echo "${SERVER_URL}" | sed 's#https\?://##')
git push "https://gitea-actions:${GITEA_TOKEN}@${HOST}/${REPO_OWNER}/${REPO_NAME}.git" HEAD:master