diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..915d3fa --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,154 @@ +name: TubeArchivistMetadata + +on: + push: + branches: + - main + tags: + - v* + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + name: Build + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore + run: dotnet restore TubeArchivistMetadata.sln + + - name: Build + run: dotnet build TubeArchivistMetadata.sln -c Release --no-restore + + - name: Package plugin + run: | + set -euo pipefail + + plugin_version="$(awk -F'\"' '/^version:/ { print $2 }' build.yaml)" + artifact="artifacts/tubearchivistmetadata_${plugin_version}.zip" + checksum="$(./scripts/package-release.sh)" + + echo "PLUGIN_VERSION=$plugin_version" >> "$GITHUB_ENV" + echo "PLUGIN_ARTIFACT=$artifact" >> "$GITHUB_ENV" + echo "PLUGIN_CHECKSUM=$checksum" >> "$GITHUB_ENV" + + - name: Validate release metadata + if: startsWith(github.ref, 'refs/tags/v') + run: | + set -euo pipefail + + tag_version="${GITHUB_REF_NAME#v}" + if [ "$PLUGIN_VERSION" != "$tag_version" ] && [ "$PLUGIN_VERSION" != "${tag_version}.0" ]; then + echo "Tag $GITHUB_REF_NAME does not match build.yaml version $PLUGIN_VERSION" >&2 + exit 1 + fi + + grep -F "\"version\": \"$PLUGIN_VERSION\"" manifest.json >/dev/null + grep -F "\"checksum\": \"$PLUGIN_CHECKSUM\"" manifest.json >/dev/null + grep -F "/releases/download/$GITHUB_REF_NAME/$(basename "$PLUGIN_ARTIFACT")" manifest.json >/dev/null + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: tubearchivistmetadata-${{ env.PLUGIN_VERSION }} + path: ${{ env.PLUGIN_ARTIFACT }} + + release: + runs-on: ubuntu-latest + name: Release + needs: build + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Setup Go for tea + uses: actions/setup-go@v5 + with: + go-version: 1.26.x + + - name: Install tea + run: go install code.gitea.io/tea@v0.14.0 + + - name: Restore + run: dotnet restore TubeArchivistMetadata.sln + + - name: Build + run: dotnet build TubeArchivistMetadata.sln -c Release --no-restore + + - name: Package plugin + run: | + set -euo pipefail + + plugin_version="$(awk -F'\"' '/^version:/ { print $2 }' build.yaml)" + artifact="artifacts/tubearchivistmetadata_${plugin_version}.zip" + checksum="$(./scripts/package-release.sh)" + + echo "PLUGIN_VERSION=$plugin_version" >> "$GITHUB_ENV" + echo "PLUGIN_ARTIFACT=$artifact" >> "$GITHUB_ENV" + echo "PLUGIN_CHECKSUM=$checksum" >> "$GITHUB_ENV" + + - name: Validate release metadata + run: | + set -euo pipefail + + tag_version="${GITHUB_REF_NAME#v}" + if [ "$PLUGIN_VERSION" != "$tag_version" ] && [ "$PLUGIN_VERSION" != "${tag_version}.0" ]; then + echo "Tag $GITHUB_REF_NAME does not match build.yaml version $PLUGIN_VERSION" >&2 + exit 1 + fi + + grep -F "\"version\": \"$PLUGIN_VERSION\"" manifest.json >/dev/null + grep -F "\"checksum\": \"$PLUGIN_CHECKSUM\"" manifest.json >/dev/null + grep -F "/releases/download/$GITHUB_REF_NAME/$(basename "$PLUGIN_ARTIFACT")" manifest.json >/dev/null + + - name: Generate release notes + run: | + set -euo pipefail + + changelog="$(awk '/changelog:/ {flag=1; next} /^[^ ]/ {flag=0} flag' build.yaml | awk '{$1=$1};1')" + { + echo "Changelog:" + echo "* $changelog" + } > release-changelog.md + + - name: Create Gitea release + env: + GITEA_SERVER_TOKEN: ${{ secrets.GITEA_SERVER_TOKEN }} + run: | + set -euo pipefail + + if [ -z "${GITEA_SERVER_TOKEN:-}" ]; then + echo "Missing GITEA_SERVER_TOKEN secret" >&2 + exit 1 + fi + + tea logins add \ + --name gitea \ + --url "$GITHUB_SERVER_URL" \ + --token "$GITEA_SERVER_TOKEN" \ + --no-version-check + + tea releases create "$GITHUB_REF_NAME" \ + --repo "$GITHUB_REPOSITORY" \ + --target "$GITHUB_SHA" \ + --title "TubeArchivist Metadata $PLUGIN_VERSION" \ + --note-file release-changelog.md \ + --asset "$PLUGIN_ARTIFACT" \ + --login gitea diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 2fb5f20..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,86 +0,0 @@ -name: TubeArchivistMetadata Release - -on: - push: - tags: - - v* - -jobs: - build: - runs-on: ubuntu-latest - name: Build & Release - permissions: - contents: write - packages: read - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: master - fetch-depth: 0 - - - name: Get release version - id: newtag - uses: "WyriHaximus/github-action-get-previous-tag@v1" - - - name: Setup .Net - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 9.0.x - - - name: Add Jellyfin GitHub Nuget registry to sources - run: | - dotnet nuget add source \ - --username DarkFighterLuke \ - --password ${{ secrets.GITHUB_TOKEN }} \ - --store-password-in-clear-text \ - --name github https://nuget.pkg.github.com/jellyfin/index.json - - - name: Get version number only - run: | - TAG=${{ steps.newtag.outputs.tag }} - echo "VERSION=${TAG#v}" >> $GITHUB_ENV - - - name: Generate release message - run: | - # Read the YAML file and extract the value of the 'changelog' field - changelog=$(awk '/changelog:/ {flag=1; next} /^[^ ]/ {flag=0} flag' build.yaml | awk '{$1=$1};1') - - # Check if changelog contains multiple lines - if [[ $(echo "$changelog" | wc -l) -gt 1 ]]; then - changelog=$(echo "$changelog" | sed 's/^/* /') - else - changelog="* $changelog" - fi - - # Create release-changelog.md - echo "Changelog:" > release-changelog.md - echo "$changelog" >> release-changelog.md - - - - name: Build Jellyfin Plugin - uses: DarkFighterLuke/jellyfin-plugin-repository-manager@7a96768accc155ac7b597351b5033532f3c48173 - id: jprm - with: - dotnet-target: net9.0 - version: ${VERSION} - update-manifest: "true" - - - name: Create release - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - artifacts: ${{ steps.jprm.outputs.artifact }} - makeLatest: latest - bodyFile: release-changelog.md - tag: ${{ steps.newtag.outputs.tag }} - allowUpdates: true - - - name: Commit manifest.json - uses: EndBug/add-and-commit@v9 - with: - add: manifest.json - commit: --signoff - message: "Update manifest.json" - pull: "--no-rebase -X ours origin master" diff --git a/README.md b/README.md index b42004c..7d50d57 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Jellyfin TubeArchivist Plugin

-Plugin Banner +Plugin Banner

@@ -38,7 +38,7 @@ The plugin interacts with TubeArchivist APIs to fetch videos and channels metada 1. Go to `Dashboard -> Plugins` and click on the `Manage Repositories` button 2. Add a new repository with the following details: - Repository name: `TubeArchivistMetadata` -- Repository URL: `https://github.com/tubearchivist/tubearchivist-jf-plugin/raw/master/manifest.json` +- Repository URL: `https://git.felixfoertsch.de/felixfoertsch/tubearchivist-jf-plugin/raw/branch/main/manifest.json` ![Add repository](https://github.com/user-attachments/assets/337ba921-bc97-47ea-815c-c664cf7661a2) 3. Go back to the catalog diff --git a/build.yaml b/build.yaml index 61f8b54..7ee0eb3 100644 --- a/build.yaml +++ b/build.yaml @@ -1,7 +1,7 @@ --- name: "TubeArchivistMetadata" guid: "dc97d0c6-28b0-4242-afb4-5833ae1b3715" -imageUrl: https://raw.githubusercontent.com/tubearchivist/tubearchivist-jf-plugin/master/images/logo.png +imageUrl: https://git.felixfoertsch.de/felixfoertsch/tubearchivist-jf-plugin/raw/branch/main/images/logo.png version: "1.4.5.0" targetAbi: "10.11.0.0" framework: "net9.0" diff --git a/manifest.json b/manifest.json index 2c07a8d..4014be2 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,14 @@ "description": "TubeArchivistMetadata is a plugin that automatically manages metadata for videos downloaded with TubeArchivist from YouTube.\n", "owner": "DarkFighterLuke", "overview": "Metadata for your TubeArchivist library on Jellyfin", - "imageUrl": "https://raw.githubusercontent.com/tubearchivist/tubearchivist-jf-plugin/master/images/logo.png", + "imageUrl": "https://git.felixfoertsch.de/felixfoertsch/tubearchivist-jf-plugin/raw/branch/main/images/logo.png", "versions": [ { "version": "1.4.5.0", "changelog": "Limit providers to TubeArchivist paths, skip empty image URLs, and fix playlist sync intervals\n", "targetAbi": "10.11.0.0", "sourceUrl": "https://git.felixfoertsch.de/felixfoertsch/tubearchivist-jf-plugin/releases/download/v1.4.5/tubearchivistmetadata_1.4.5.0.zip", - "checksum": "dad305a75a6a07f5d8185a6e8340cbbd", + "checksum": "2c0632e30631925b7f42b30dc567819f", "timestamp": "2026-07-01T06:20:00Z" }, { diff --git a/scripts/package-release.sh b/scripts/package-release.sh new file mode 100755 index 0000000..c47a016 --- /dev/null +++ b/scripts/package-release.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Description: Build a deterministic Jellyfin plugin release zip. +# Usage: ./scripts/package-release.sh + +main() { + local root + root="$(git rev-parse --show-toplevel)" + cd "$root" + + local version + version="$(awk -F'\"' '/^version:/ { print $2 }' build.yaml)" + + local dll_path + dll_path="Jellyfin.Plugin.TubeArchivistMetadata/bin/Release/net9.0/Jellyfin.Plugin.TubeArchivistMetadata.dll" + if [[ ! -f "$dll_path" ]]; then + echo "Missing release DLL: $dll_path" >&2 + exit 1 + fi + + local output_dir + output_dir="artifacts" + mkdir -p "$output_dir" + + local zip_path + zip_path="$output_dir/tubearchivistmetadata_${version}.zip" + rm -f "$zip_path" + + local package_dir + package_dir="$(mktemp -d)" + trap 'rm -rf "'"$package_dir"'"' EXIT + + cp "$dll_path" "$package_dir/Jellyfin.Plugin.TubeArchivistMetadata.dll" + TZ=UTC touch -t 198001010000 "$package_dir/Jellyfin.Plugin.TubeArchivistMetadata.dll" + ( + cd "$package_dir" + TZ=UTC zip -X -q "$root/$zip_path" Jellyfin.Plugin.TubeArchivistMetadata.dll + ) + + local entry_count + entry_count="$(zipinfo -1 "$zip_path" | wc -l | tr -d ' ')" + if [[ "$entry_count" != "1" ]]; then + echo "Unexpected zip entry count: $entry_count" >&2 + zipinfo -1 "$zip_path" >&2 + exit 1 + fi + + local entry_name + entry_name="$(zipinfo -1 "$zip_path")" + if [[ "$entry_name" != "Jellyfin.Plugin.TubeArchivistMetadata.dll" ]]; then + echo "Unexpected zip entry: $entry_name" >&2 + exit 1 + fi + + md5sum "$zip_path" | cut -d' ' -f1 +} + +main "$@"