name: '🏗️ Build Plugin' on: push: branches: - master paths-ignore: - '**/*.md' pull_request: branches: - master paths-ignore: - '**/*.md' workflow_dispatch: jobs: build: runs-on: linux/amd64 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 "label=${LABEL}" >> $GITHUB_OUTPUT echo "Build version: ${VERSION} (${LABEL})" - name: Set build version working-directory: build-${{ github.run_id }} run: | sed -i "s/^version:.*/version: \"${{ steps.version.outputs.version }}\"/" build.yaml - 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 Plugin id: jprm working-directory: build-${{ github.run_id }} run: | mkdir -p artifacts jprm --verbosity=debug plugin build . ARTIFACT=$(find . -name "*.zip" -type f -print -quit | sed 's|^\./||') LATEST="artifacts/srfplay_latest.zip" cp "${ARTIFACT}" "${LATEST}" echo "artifact=${LATEST}" >> $GITHUB_OUTPUT echo "Found artifact: ${ARTIFACT} -> ${LATEST}" - name: Upload build artifact uses: actions/upload-artifact@v3 with: name: srfplay-${{ steps.version.outputs.label }}-${{ steps.version.outputs.version }} path: build-${{ github.run_id }}/${{ steps.jprm.outputs.artifact }} retention-days: 30 if-no-files-found: error - name: Cleanup if: always() run: rm -rf build-${{ github.run_id }}