feat: Quality recommendations in request mdoal to help user decide wh… #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| env: | |
| JELLYFIN_VERSION: "10.11.2" | |
| TARGET_ABI: "10.11.0.0" | |
| REPO_OWNER: "varunaditya-plus" | |
| REPO_NAME: "BetterSeerrTabs" | |
| CSPROJ: "src/Jellyfin.Plugin.BetterSeerrTabs/Jellyfin.Plugin.BetterSeerrTabs.csproj" | |
| ASSEMBLY_INFO: "src/Jellyfin.Plugin.BetterSeerrTabs/Properties/AssemblyInfo.cs" | |
| jobs: | |
| extract-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.parse.outputs.version }} | |
| should_release: ${{ steps.parse.outputs.should_release }} | |
| changelog: ${{ steps.parse.outputs.changelog }} | |
| steps: | |
| - name: Parse version from commit message | |
| id: parse | |
| run: | | |
| MSG=$(jq -r '.head_commit.message' "$GITHUB_EVENT_PATH" | head -n1) | |
| if [[ "$MSG" =~ \(v([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\) ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "should_release=true" >> "$GITHUB_OUTPUT" | |
| echo "Detected release version: $VERSION" | |
| CHANGELOG=$(printf '%s' "$MSG" | sed -E 's/[[:space:]]*\(v[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\)[[:space:]]*$//') | |
| if [[ "$CHANGELOG" == *:* ]]; then | |
| CHANGELOG="${CHANGELOG#*:}" | |
| fi | |
| CHANGELOG=$(printf '%s' "$CHANGELOG" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g') | |
| if [[ -z "$CHANGELOG" ]]; then | |
| CHANGELOG="Release ${VERSION}." | |
| fi | |
| echo "changelog<<EOF" >> "$GITHUB_OUTPUT" | |
| printf '%s\n' "$CHANGELOG" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| echo "Changelog: $CHANGELOG" | |
| else | |
| echo "should_release=false" >> "$GITHUB_OUTPUT" | |
| echo "No (vX.X.X.X) version found in commit message; skipping release." | |
| fi | |
| release: | |
| needs: extract-version | |
| if: needs.extract-version.outputs.should_release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Resolve version | |
| id: version | |
| run: | | |
| VERSION="${{ needs.extract-version.outputs.version }}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Release version: $VERSION" | |
| - name: Check tag does not already exist | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| if git rev-parse "refs/tags/${VERSION}" >/dev/null 2>&1; then | |
| echo "Tag ${VERSION} already exists. Aborting to avoid duplicate release." | |
| exit 1 | |
| fi | |
| - name: Update version in project files | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| sed -i "s/<Version>[0-9.]*<\\/Version>/<Version>${VERSION}<\\/Version>/" "${{ env.CSPROJ }}" | |
| sed -i "s/\\[assembly: AssemblyVersion(\"[0-9.]*\")\\]/[assembly: AssemblyVersion(\"${VERSION}\")]/" "${{ env.ASSEMBLY_INFO }}" | |
| sed -i "s/\\[assembly: AssemblyFileVersion(\"[0-9.]*\")\\]/[assembly: AssemblyFileVersion(\"${VERSION}\")]/" "${{ env.ASSEMBLY_INFO }}" | |
| jq --arg version "$VERSION" '.version = $version' meta.json > meta.json.tmp | |
| mv meta.json.tmp meta.json | |
| echo "Updated version to ${VERSION} in csproj, AssemblyInfo, and meta.json" | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Build plugin | |
| run: | | |
| dotnet build "${{ env.CSPROJ }}" \ | |
| --configuration Release \ | |
| -p:JellyfinVersion=${{ env.JELLYFIN_VERSION }} | |
| - name: Resolve Jellyfin zip ABI from latest jellyfin-web release | |
| id: jellyfin | |
| run: | | |
| TAG=$(curl -fsSL \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| https://api.github.com/repos/jellyfin/jellyfin-web/releases/latest \ | |
| | jq -r '.tag_name') | |
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Unexpected jellyfin-web release tag: ${TAG}" | |
| exit 1 | |
| fi | |
| JELLYFIN_ABI=$(echo "${TAG#v}" | cut -d. -f1-2) | |
| ZIP_NAME="Jellyfin.Plugin.BetterSeerrTabs_${JELLYFIN_ABI}.0.zip" | |
| echo "jellyfin_abi=${JELLYFIN_ABI}" >> "$GITHUB_OUTPUT" | |
| echo "zip_name=${ZIP_NAME}" >> "$GITHUB_OUTPUT" | |
| echo "Latest jellyfin-web tag: ${TAG} -> ABI ${JELLYFIN_ABI}, zip ${ZIP_NAME}" | |
| - name: Package release zip | |
| id: package | |
| env: | |
| CHANGELOG: ${{ needs.extract-version.outputs.changelog }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| OUT_DIR="${GITHUB_WORKSPACE}/src/Jellyfin.Plugin.BetterSeerrTabs/bin/Release/net9.0" | |
| TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%S.0000000Z") | |
| ZIP_NAME="${{ steps.jellyfin.outputs.zip_name }}" | |
| DIST_DIR="${GITHUB_WORKSPACE}/dist" | |
| ZIP_PATH="${DIST_DIR}/${ZIP_NAME}" | |
| jq -n \ | |
| --arg version "$VERSION" \ | |
| --arg timestamp "$TIMESTAMP" \ | |
| --arg targetAbi "${{ env.TARGET_ABI }}" \ | |
| --arg changelog "$CHANGELOG" \ | |
| '{ | |
| category: "General", | |
| changelog: $changelog, | |
| description: "The best way to discover and request Movies and TV Shows through Seerr directly in Jellyfin.", | |
| guid: "c8e4f2a1-9b3d-4e7f-a6c2-1d5e8f0a3b7c", | |
| name: "BetterSeerrTabs", | |
| overview: "This plugin lets you add two extra tabs to your top bar, allowing you to discover new Movies and TV Shows, and easily request them in any quality profile you want.", | |
| owner: "varunaditya-plus", | |
| targetAbi: $targetAbi, | |
| timestamp: $timestamp, | |
| version: $version, | |
| status: "Active", | |
| autoUpdate: true, | |
| assemblies: ["Jellyfin.Plugin.BetterSeerrTabs.dll"] | |
| }' > "${OUT_DIR}/meta.json" | |
| jq --arg version "$VERSION" \ | |
| --arg timestamp "$TIMESTAMP" \ | |
| --arg targetAbi "${{ env.TARGET_ABI }}" \ | |
| --arg changelog "$CHANGELOG" \ | |
| '.version = $version | .timestamp = $timestamp | .targetAbi = $targetAbi | .changelog = $changelog' \ | |
| meta.json > meta.json.tmp | |
| mv meta.json.tmp meta.json | |
| mkdir -p "${DIST_DIR}" | |
| ( | |
| cd "${OUT_DIR}" | |
| zip -j "${ZIP_PATH}" \ | |
| Jellyfin.Plugin.BetterSeerrTabs.dll \ | |
| meta.json \ | |
| thumb.png | |
| ) | |
| CHECKSUM=$(md5sum "${ZIP_PATH}" | awk '{print toupper($1)}') | |
| SOURCE_URL="https://github.com/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}/releases/download/${VERSION}/${ZIP_NAME}" | |
| echo "zip_name=${ZIP_NAME}" >> "$GITHUB_OUTPUT" | |
| echo "checksum=${CHECKSUM}" >> "$GITHUB_OUTPUT" | |
| echo "source_url=${SOURCE_URL}" >> "$GITHUB_OUTPUT" | |
| echo "timestamp=${TIMESTAMP}" >> "$GITHUB_OUTPUT" | |
| - name: Update manifest.json | |
| env: | |
| CHANGELOG: ${{ needs.extract-version.outputs.changelog }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| jq --arg version "$VERSION" \ | |
| --arg changelog "$CHANGELOG" \ | |
| --arg targetAbi "${{ env.TARGET_ABI }}" \ | |
| --arg sourceUrl "${{ steps.package.outputs.source_url }}" \ | |
| --arg checksum "${{ steps.package.outputs.checksum }}" \ | |
| --arg timestamp "${{ steps.package.outputs.timestamp }}" \ | |
| ' | |
| .[0].versions = ( | |
| [ | |
| { | |
| version: $version, | |
| changelog: $changelog, | |
| targetAbi: $targetAbi, | |
| sourceUrl: $sourceUrl, | |
| checksum: $checksum, | |
| timestamp: $timestamp, | |
| dependencies: [] | |
| } | |
| ] | |
| + (.[0].versions | map(select(.version != $version))) | |
| ) | |
| ' manifest.json > manifest.json.tmp | |
| mv manifest.json.tmp manifest.json | |
| - name: Commit version and manifest updates | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add manifest.json meta.json "${{ env.CSPROJ }}" "${{ env.ASSEMBLY_INFO }}" | |
| if git diff --staged --quiet; then | |
| echo "No version file changes to commit" | |
| else | |
| git commit -m "chore: bump version to ${VERSION}" | |
| git push origin HEAD:main | |
| fi | |
| - name: Create and push release tag | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| git tag -a "${VERSION}" -m "BetterSeerrTabs ${VERSION}" | |
| git push origin "${VERSION}" | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| name: BetterSeerrTabs ${{ steps.version.outputs.version }} | |
| body: | | |
| This is the release for version ${{ steps.version.outputs.version }} of BetterSeerrTabs. To install, follow the instructions in the Readme. | |
| Changelog: | |
| ${{ needs.extract-version.outputs.changelog }} | |
| files: dist/${{ steps.package.outputs.zip_name }} | |
| fail_on_unmatched_files: true |