-
Notifications
You must be signed in to change notification settings - Fork 13
137 lines (115 loc) · 4.9 KB
/
Copy pathbuild.yml
File metadata and controls
137 lines (115 loc) · 4.9 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
name: Build
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
build:
name: Build Plugin
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 backend
id: backend_build
continue-on-error: true
run: |
set -o pipefail
dotnet build backend/Moonfin.Server.csproj -c Release 2>&1 | tee "${{ runner.temp }}/backend-build.log"
- name: Fail if build failed
if: steps.backend_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 }}"
}
EOF
if [ -f "${{ runner.temp }}/backend-build.log" ]; then
cp "${{ runner.temp }}/backend-build.log" "${{ runner.temp }}/build-results/"
fi
- 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 version from csproj
if: github.event_name == 'push' && steps.backend_build.outcome == 'success'
id: version
run: |
VERSION=$(grep -oPm1 '(?<=<AssemblyVersion>)[^<]+' backend/Moonfin.Server.csproj)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Read target ABI from csproj
if: github.event_name == 'push' && steps.backend_build.outcome == 'success'
id: abi
run: |
ABI=$(grep 'Jellyfin.Controller' backend/Moonfin.Server.csproj | grep -oP 'Version="\K[^"]+')
echo "abi=${ABI}.0" >> "$GITHUB_OUTPUT"
- name: Package release ZIP
if: github.event_name == 'push' && steps.backend_build.outcome == 'success'
id: package
run: |
VERSION="${{ steps.version.outputs.version }}"
TARGET_ABI="${{ steps.abi.outputs.abi }}"
PLUGIN_GUID="8c5d0e91-4f2a-4b6d-9e3f-1a7c8d9e0f2b"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
mkdir -p release
cp backend/bin/Release/net8.0/Moonfin.Server.dll release/
if [ -f frontend/index.html ]; then
mkdir -p release/frontend
cp -R frontend/. release/frontend/
rm -rf release/frontend/node_modules
rm -f release/frontend/package.json release/frontend/package-lock.json
fi
cat > 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 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"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Upload build artifact
if: github.event_name == 'push' && steps.backend_build.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package.outputs.zip_name }}
path: ${{ steps.package.outputs.zip_name }}
- name: Build summary (master)
if: github.event_name == 'push' && steps.backend_build.outcome == 'success'
run: |
echo "## Build Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
echo "| **Version** | \`${{ steps.version.outputs.version }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| **Checksum (MD5)** | \`${{ steps.package.outputs.checksum }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| **Artifact** | \`${{ steps.package.outputs.zip_name }}\` |" >> $GITHUB_STEP_SUMMARY