autosave when applying settings to users (#149) #115
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: 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 |