name: '🏗️ Build Plugin' on: push: branches: - master paths-ignore: - '**/*.md' pull_request: branches: - master paths-ignore: - '**/*.md' workflow_dispatch: jobs: build: runs-on: ubuntu-latest container: image: gitea.tourolle.paris/dtourolle/srfplay-builder:latest steps: - name: Checkout repository uses: actions/checkout@v4 with: path: build-${{ github.run_id }} - name: Cache NuGet packages uses: actions/cache@v3 with: path: ~/.nuget/packages key: nuget-${{ hashFiles('**/Jellyfin.Plugin.SRFPlay.csproj', '**/Jellyfin.Plugin.SRFPlay.Tests.csproj') }} restore-keys: nuget- - name: Restore dependencies working-directory: build-${{ github.run_id }} run: dotnet restore Jellyfin.Plugin.SRFPlay.sln - name: Compute build version id: version run: | # For PRs, stamp a distinct version so a side-loaded build is # identifiable in Jellyfin: 1.0.-pr.. # For plain master pushes, keep a date-based dev version. DATE=$(date -u +"%Y%m%d") if [ -n "${{ github.event.pull_request.number }}" ]; then VERSION="1.0.${DATE}.${{ github.run_number }}" LABEL="pr${{ github.event.pull_request.number }}" else VERSION="1.0.${DATE}.${{ github.run_number }}" LABEL="master" fi echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "format=${VERSION}%02d" >> $GITHUB_OUTPUT echo "label=${LABEL}" >> $GITHUB_OUTPUT echo "Build version: ${VERSION} (${LABEL})" - name: Build solution working-directory: build-${{ github.run_id }} run: dotnet build Jellyfin.Plugin.SRFPlay.sln --configuration Release --no-restore --no-self-contained /m:1 - name: Run tests working-directory: build-${{ github.run_id }} run: dotnet test Jellyfin.Plugin.SRFPlay.sln --no-build --configuration Release --verbosity normal - name: Build Jellyfin Plugins working-directory: build-${{ github.run_id }} # One zip per Jellyfin generation (see .gitea/scripts/build-plugins.sh). run: .gitea/scripts/build-plugins.sh "${{ steps.version.outputs.format }}" - name: Upload build artifacts uses: actions/upload-artifact@v3 with: name: srfplay-${{ steps.version.outputs.label }}-${{ steps.version.outputs.version }} path: build-${{ github.run_id }}/artifacts/*.zip retention-days: 30 if-no-files-found: error - name: Cleanup if: always() run: rm -rf build-${{ github.run_id }}