-
Notifications
You must be signed in to change notification settings - Fork 23
160 lines (139 loc) · 6.71 KB
/
Copy pathbuild.yml
File metadata and controls
160 lines (139 loc) · 6.71 KB
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
153
154
155
156
157
158
159
160
name: Build
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
build:
name: Build Plugins
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build Jellyfin plugin
id: backend_build
continue-on-error: true
run: |
set -o pipefail
rm -rf Jellyfin/backend/bin/Release Jellyfin/backend/obj/Release
rm -rf Jellyfin/tools/verify-plugin/bin/Release Jellyfin/tools/verify-plugin/obj/Release
dotnet publish Jellyfin/backend/Moonfin.Server.csproj \
-c Release \
-o Jellyfin/backend/bin/Release/net8.0/publish \
2>&1 | tee "${{ runner.temp }}/backend-build.log"
dotnet run --project Jellyfin/tools/verify-plugin/VerifyPlugin.csproj \
-c Release -- \
Jellyfin/backend/bin/Release/net8.0/publish/Moonfin.Server.dll \
2>&1 | tee -a "${{ runner.temp }}/backend-build.log"
- name: Build Emby plugin
id: emby_build
continue-on-error: true
run: |
set -o pipefail
EMBY_VERSION=$(grep -oPm1 '(?<=<AssemblyVersion>)[^<]+' Emby/Emby.Plugins.Moonfin/Emby.Plugins.Moonfin.csproj)
echo "version=$EMBY_VERSION" >> "$GITHUB_OUTPUT"
echo "zip_name=Moonfin.Emby-${EMBY_VERSION}.zip" >> "$GITHUB_OUTPUT"
# build.sh builds the netstandard2.1 plugin and assembles the drop-in zip.
cd Emby
bash build.sh "$EMBY_VERSION" 2>&1 | tee "${{ runner.temp }}/emby-build.log"
- name: Fail if any build failed
if: steps.backend_build.outcome != 'success' || steps.emby_build.outcome != 'success'
run: exit 1
- name: Save build results
if: always() && github.event_name == 'pull_request'
run: |
mkdir -p "${{ runner.temp }}/build-results"
cat > "${{ runner.temp }}/build-results/outcomes.json" <<EOF
{
"pr_number": ${{ github.event.pull_request.number }},
"sha": "${{ github.event.pull_request.head.sha }}",
"backend_build": "${{ steps.backend_build.outcome }}",
"emby_build": "${{ steps.emby_build.outcome }}"
}
EOF
for log in backend-build.log emby-build.log; do
if [ -f "${{ runner.temp }}/$log" ]; then
cp "${{ runner.temp }}/$log" "${{ runner.temp }}/build-results/"
fi
done
- name: Upload build results
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: build-results
path: ${{ runner.temp }}/build-results/
- name: Read Jellyfin version and ABI
if: github.event_name == 'push' && steps.backend_build.outcome == 'success' && steps.emby_build.outcome == 'success'
id: jf_meta
run: |
VERSION=$(grep -oPm1 '(?<=<AssemblyVersion>)[^<]+' Jellyfin/backend/Moonfin.Server.csproj)
ABI=$(grep 'Jellyfin.Controller' Jellyfin/backend/Moonfin.Server.csproj | grep -oP 'Version="\K[^"]+')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "abi=${ABI}.0" >> "$GITHUB_OUTPUT"
- name: Package Jellyfin ZIP
if: github.event_name == 'push' && steps.backend_build.outcome == 'success' && steps.emby_build.outcome == 'success'
id: jf_package
run: |
VERSION="${{ steps.jf_meta.outputs.version }}"
TARGET_ABI="${{ steps.jf_meta.outputs.abi }}"
PLUGIN_GUID="8c5d0e91-4f2a-4b6d-9e3f-1a7c8d9e0f2b"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
mkdir -p jellyfin-release
cp Jellyfin/backend/bin/Release/net8.0/publish/Moonfin.Server.dll jellyfin-release/
cp Jellyfin/backend/bin/Release/net8.0/publish/SharpCompress.dll jellyfin-release/
if [ -f Jellyfin/frontend/index.html ]; then
mkdir -p jellyfin-release/frontend
cp -R Jellyfin/frontend/. jellyfin-release/frontend/
rm -rf jellyfin-release/frontend/node_modules
rm -f jellyfin-release/frontend/package.json jellyfin-release/frontend/package-lock.json
fi
cat > jellyfin-release/meta.json <<EOF
{
"category": "General",
"changelog": "",
"description": "Moonfin brings a modern TV-style UI to Jellyfin web. Features include: custom navbar, media bar with featured content, Jellyseerr integration, and cross-device settings synchronization.",
"guid": "${PLUGIN_GUID}",
"name": "Moonfin",
"overview": "Custom UI and settings sync for Jellyfin",
"owner": "RadicalMuffinMan",
"targetAbi": "${TARGET_ABI}",
"timestamp": "${TIMESTAMP}",
"version": "${VERSION}",
"status": "Active",
"autoUpdate": true,
"assemblies": ["Moonfin.Server.dll"]
}
EOF
ZIP_NAME="Moonfin.Server-${VERSION}.zip"
cd jellyfin-release && zip -r "../${ZIP_NAME}" . && cd ..
CHECKSUM=$(md5sum "$ZIP_NAME" | awk '{print toupper($1)}')
echo "zip_name=$ZIP_NAME" >> "$GITHUB_OUTPUT"
echo "checksum=$CHECKSUM" >> "$GITHUB_OUTPUT"
- name: Upload Jellyfin artifact
if: github.event_name == 'push' && steps.backend_build.outcome == 'success' && steps.emby_build.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.jf_package.outputs.zip_name }}
path: ${{ steps.jf_package.outputs.zip_name }}
- name: Upload Emby artifact
if: github.event_name == 'push' && steps.backend_build.outcome == 'success' && steps.emby_build.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.emby_build.outputs.zip_name }}
path: Emby/${{ steps.emby_build.outputs.zip_name }}
- name: Build summary (master)
if: github.event_name == 'push' && steps.backend_build.outcome == 'success' && steps.emby_build.outcome == 'success'
run: |
echo "## Build Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Plugin | Version | Artifact |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|---|" >> $GITHUB_STEP_SUMMARY
echo "| **Jellyfin** | \`${{ steps.jf_meta.outputs.version }}\` | \`${{ steps.jf_package.outputs.zip_name }}\` (MD5 \`${{ steps.jf_package.outputs.checksum }}\`) |" >> $GITHUB_STEP_SUMMARY
echo "| **Emby** | \`${{ steps.emby_build.outputs.version }}\` | \`${{ steps.emby_build.outputs.zip_name }}\` |" >> $GITHUB_STEP_SUMMARY