Files
jellyfinsso/.gitea/workflows/release.yml
Pascal Linxweiler 4b827941ee
All checks were successful
Build Plugin / build (push) Successful in 4m29s
Release Plugin / release (push) Successful in 1m7s
fix: make the release workflow build and package a real Jellyfin plugin
The release workflow was copied from another project and could not succeed on
any tag: it installed the .NET 8 SDK for a net9.0 project, published a
JellyfinSso.csproj that does not exist, called a missing update_manifest.py,
and zipped the entire publish tree instead of the three DLLs declared in
build.yaml.

Replace it with a tag-driven release:

- Build with the .NET 9 SDK, injecting the tag version via -p:Version,
  -p:AssemblyVersion and -p:FileVersion so the assembly no longer carries a
  hardcoded 1.0.3.0.
- Package via scripts/build_plugin.py, which emits the JPRM layout Jellyfin
  expects: the build.yaml artifacts plus a generated meta.json. The previous
  zips shipped without meta.json, which only worked for repository installs
  because Jellyfin synthesises one from the folder name.
- Update manifest.json via scripts/update_manifest.py, keeping build.yaml as
  the single source of truth for plugin metadata.
- Commit the zip and manifest to main and attach the zip to the Gitea release.
  Pushing uses the injected token, falling back to a RELEASE_TOKEN secret when
  the built-in one lacks write access.

Also fix the published download URLs. manifest.json and the README pointed at
pascallinxweiler/jellyfinplugin, which 404s; the repository is jellyfinsso, so
the plugin repository could not be added to Jellyfin and no version could be
downloaded. The workflow now derives the URL from GITHUB_REPOSITORY.

Add a build workflow so main and pull requests are compiled and packaged.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-29 15:18:40 +02:00

116 lines
3.6 KiB
YAML

name: Release Plugin
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install packaging dependencies
run: python -m pip install --quiet --upgrade pyyaml
- name: Read version and changelog from tag
id: meta
run: |
set -euo pipefail
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
# Annotated tag message becomes the changelog; build.yaml is the fallback.
{
echo "changelog<<CHANGELOG_EOF"
git tag -l --format='%(contents)' "$GITHUB_REF_NAME"
echo "CHANGELOG_EOF"
} >> "$GITHUB_OUTPUT"
- name: Build and package plugin
id: package
env:
VERSION: ${{ steps.meta.outputs.version }}
CHANGELOG: ${{ steps.meta.outputs.changelog }}
run: |
set -euo pipefail
python scripts/build_plugin.py \
--version "$VERSION" \
--changelog "$CHANGELOG" \
--output "$RUNNER_TEMP/dist"
- name: Switch to main
run: |
set -euo pipefail
git checkout -- .
git fetch origin main
git checkout -B main origin/main
- name: Update dist, build.yaml and manifest.json
env:
VERSION: ${{ steps.package.outputs.version }}
ZIP_NAME: ${{ steps.package.outputs.zip_name }}
CHECKSUM: ${{ steps.package.outputs.checksum }}
CHANGELOG: ${{ steps.meta.outputs.changelog }}
run: |
set -euo pipefail
mkdir -p dist
cp "$RUNNER_TEMP/dist/$ZIP_NAME" "dist/$ZIP_NAME"
python scripts/build_plugin.py --version "$VERSION" --sync-only
python scripts/update_manifest.py \
--version "$VERSION" \
--checksum "$CHECKSUM" \
--changelog "$CHANGELOG" \
--source-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/raw/branch/main/dist/${ZIP_NAME}"
- name: Commit and push to main
env:
# Gitea injects GITHUB_TOKEN; set RELEASE_TOKEN if that token does not
# have write access to the repository.
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
DEFAULT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TOKEN="${RELEASE_TOKEN:-$DEFAULT_TOKEN}"
if [ -z "$TOKEN" ]; then
echo "no token available to push manifest.json" >&2
exit 1
fi
git config user.name "gitea-actions"
git config user.email "actions@git.linxweiler.xyz"
git add dist manifest.json build.yaml Jellyfin.Plugin.OidcAuth/Jellyfin.Plugin.OidcAuth.csproj
if git diff --cached --quiet; then
echo "nothing to commit"
exit 0
fi
git commit -m "release: ${GITHUB_REF_NAME}"
git remote set-url origin \
"https://x-access-token:${TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
git push origin main
- name: Attach zip to Gitea release
uses: akkuman/gitea-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: dist/${{ steps.package.outputs.zip_name }}
body: ${{ steps.meta.outputs.changelog }}