-
Notifications
You must be signed in to change notification settings - Fork 25
152 lines (149 loc) · 5.52 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Jellyfin Plugin Release
on:
release:
types:
- created
- edited
- released
permissions:
contents: write
deployments: write
id-token: write
pages: 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
- uses: actions/download-artifact@v4
with:
name: Emby.Plugin.Bangumi
- name: Upload to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: "${{ github.token }}"
tag: ${{ github.ref_name }}
overwrite: true
file_glob: true
file: "*.Plugin.Bangumi.{dll,zip}"
repository:
name: Update Plugin Repository
runs-on: ubuntu-latest
needs: upload
steps:
- uses: actions/download-artifact@v4
with:
name: Jellyfin.Plugin.Bangumi
- 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://jellyfin-plugin-bangumi.kookxiang.dev/repository.json | % Content | ConvertFrom-Json
New-Item -ItemType Directory -Force -Path Release
$Repository[0].versions = $Repository[0].versions | Where-Object { $_.version -ne $env:VERSION }
foreach ($Version in $Repository[0].versions) {
Invoke-WebRequest -Uri $Version.sourceUrl -OutFile "Release/$($Version.version).zip"
$Version.sourceUrl = "https://kookxiang.github.io/jellyfin-plugin-bangumi/$($Version.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://kookxiang.github.io/jellyfin-plugin-bangumi/$($env:VERSION).zip"
timestamp = Get-Date -AsUTC -Format s
version = $env:VERSION
}) + $Repository[0].versions
Copy-Item -Path Jellyfin.Plugin.Bangumi.zip -Destination Release/$($env:VERSION).zip -Recurse
ConvertTo-Json @($Repository[0]) -Compress -Depth 5 | Out-File Release/repository.json -Encoding UTF8NoBOM -NoNewline
- name: Generate GitHub Pages Artifact
uses: actions/upload-artifact@v4
with:
name: plugin-repository
path: Release/*
retention-days: 1
deploy-github-pages:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: repository
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: plugin-repository
path: pages
- name: Repack Artifact for GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: pages/
- name: Deploy
uses: actions/deploy-pages@v4
deploy-cloudflare-pages:
name: Depoly to Cloudflare Pages
runs-on: ubuntu-latest
needs: repository
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: plugin-repository
path: pages
- name: Replace URL
run: sed -i "s|https://kookxiang.github.io/jellyfin-plugin-bangumi/|https://jellyfin-plugin-bangumi.kookxiang.dev/|g" pages/repository.json
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy pages --project-name=jellyfin-plugin-bangumi