-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Jellyfin Plugin Release | ||
|
||
on: | ||
release: | ||
|
||
permissions: | ||
contents: write | ||
deployments: write | ||
|
||
jobs: | ||
build: | ||
name: Build Release Package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Patch version | ||
run: sed -i "/Version/s/>.*</>${{ github.ref_name }}.0</" Directory.Build.props | ||
- name: Setup .NET 8.x | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8 | ||
- name: Restore NuGet Packages | ||
run: dotnet restore | ||
- name: .NET Publish | ||
run: dotnet publish --configuration Release --output publish Jellyfin.Plugin.Bangumi | ||
- name: Generate Jellyfin Plugin Metadata | ||
shell: pwsh | ||
env: | ||
CHANGELOG: ${{ github.event.release.body }} | ||
run: | | ||
@{ | ||
category = "Metadata" | ||
changelog = $env:CHANGELOG | ||
description = "Jellyfin bgm.tv 数据源插件,用于拉取中文番剧信息及图片。" | ||
guid = "41b59f1b-a6cf-474a-b416-785379cbd856" | ||
name = "Bangumi" | ||
overview = "bgm.tv metadata provider for Jellyfin" | ||
owner = "kookxiang" | ||
targetAbi = "10.9.0.0" | ||
timestamp = Get-Date -AsUTC -Format s | ||
version = "${{ github.ref_name }}.0" | ||
} | ConvertTo-Json -Compress | Out-File "publish/meta.json" -Encoding UTF8 -NoNewline | ||
- name: Create Release Artifact | ||
run: zip -9j Jellyfin.Plugin.Bangumi.zip publish/*.dll publish/meta.json | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: Jellyfin.Plugin.Bangumi | ||
path: Jellyfin.Plugin.Bangumi.zip | ||
- name: .NET Publish (Emby) | ||
run: dotnet publish --configuration Release --output publish Emby.Plugin.Bangumi | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: Emby.Plugin.Bangumi | ||
path: publish/Emby.Plugin.Bangumi.dll | ||
upload: | ||
name: Upload to GitHub Release | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Jellyfin.Plugin.Bangumi | ||
path: Jellyfin.Plugin.Bangumi.zip | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Emby.Plugin.Bangumi | ||
path: Emby.Plugin.Bangumi.dll | ||
- name: Upload to Release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: "${{ github.token }}" | ||
tag: ci | ||
overwrite: true | ||
file_glob: true | ||
file: "*.Plugin.Bangumi.{dll,zip}" | ||
repository: | ||
name: Update Plugin Repository | ||
runs-on: ubuntu-latest | ||
# if: github.event.release.draft == false | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Jellyfin.Plugin.Bangumi | ||
path: Jellyfin.Plugin.Bangumi.zip | ||
- name: Create Plugin Repository for Jellyfin | ||
shell: pwsh | ||
env: | ||
CHANGELOG: ${{ github.event.release.body }} | ||
TOKEN: ${{ github.token }} | ||
VERSION: ${{ github.ref_name }}.0 | ||
run: | | ||
$Repository = Invoke-WebRequest https://kookxiang.github.io/jellyfin-plugin-bangumi/repository.json | % Content | ConvertFrom-Json | ||
New-Item -ItemType Directory -Force -Path Release | ||
foreach ($Version in $Repository[0].versions) { | ||
if ($Version.version -eq $env:VERSION) { | ||
$Repository[0].versions.Remove($Version); | ||
} else { | ||
Invoke-WebRequest -Uri $Version.sourceUrl -OutFile "Release/$($Version.version).zip" | ||
} | ||
$Version.sourceUrl = "https://jellyfin-plugin-bangumi.kookxiang.dev/$version.zip" | ||
} | ||
$Repository[0].versions = @(@{ | ||
checksum = (Get-FileHash -Algorithm MD5 "Jellyfin.Plugin.Bangumi.zip").Hash.ToLower() | ||
changelog = $env:CHANGELOG | ||
targetAbi = "10.9.0.0" | ||
sourceUrl = "https://jellyfin-plugin-bangumi.kookxiang.dev/$version.zip" | ||
timestamp = Get-Date -AsUTC -Format s | ||
version = "$version.0" | ||
}) + $Repository[0].versions | ||
ConvertTo-Json $Repository -Compress | Out-File Release/repository.json -Encoding UTF8NoBOM -NoNewline | ||
- name: Deploy to Cloudflare Pages | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
command: pages deploy Release --project-name=jellyfin-plugin-bangumi --env=dev | ||
# gitHubToken: ${{ github.token }} |