name: Build and Release Plugin on: push: tags: - 'v*' jobs: release: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: | 9.0.x 10.0.x - name: Build Plugin run: dotnet build JellyfinPlugin/JellyfinPlugin.csproj -c Release - name: Create ZIP Archives run: | cd JellyfinPlugin/bin/Release/ # Zip net9.0 (Jellyfin 10.11) cd net9.0 zip -j ../../../../BlackBarRemover_${{ github.ref_name }}_jf10.11.zip * cd .. # Zip net10.0 (Jellyfin 12.0) cd net10.0 zip -j ../../../../BlackBarRemover_${{ github.ref_name }}_jf12.0.zip * cd .. - name: Generate Checksums id: checksum run: | MD5_SUM_9=$(md5sum BlackBarRemover_${{ github.ref_name }}_jf10.11.zip | awk '{print $1}') MD5_SUM_10=$(md5sum BlackBarRemover_${{ github.ref_name }}_jf12.0.zip | awk '{print $1}') echo "md5_9=$MD5_SUM_9" >> $GITHUB_OUTPUT echo "md5_10=$MD5_SUM_10" >> $GITHUB_OUTPUT - name: Create Gitea Release run: | API_URL="${{ github.api_url }}" REPO="${{ github.repository }}" TOKEN="${{ github.token }}" TAG="${{ github.ref_name }}" IS_PRERELEASE="false" if [[ "$TAG" =~ beta|alpha|^v0\. ]]; then IS_PRERELEASE="true" fi # Check if release exists EXISTING_REL=$(curl -s -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/tags/$TAG") REL_ID=$(echo "$EXISTING_REL" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) if [ -z "$REL_ID" ] || [ "$REL_ID" == "null" ]; then RELEASE_RES=$(curl -s -X POST "$API_URL/repos/$REPO/releases" \ -H "Authorization: token $TOKEN" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\", \"name\":\"Release $TAG\", \"body\":\"Automated release\", \"draft\":false, \"prerelease\":$IS_PRERELEASE}") REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2) fi # Delete existing assets for this release if present ASSETS=$(curl -s -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/$REL_ID/assets") echo "$ASSETS" | grep -o '"id":[0-9]*' | cut -d':' -f2 | while read -r asset_id; do if [ -n "$asset_id" ]; then curl -s -X DELETE -H "Authorization: token $TOKEN" "$API_URL/repos/$REPO/releases/$REL_ID/assets/$asset_id" fi done # Upload Assets curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ -H "Authorization: token $TOKEN" \ -F "attachment=@BlackBarRemover_${TAG}_jf10.11.zip" curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \ -H "Authorization: token $TOKEN" \ -F "attachment=@BlackBarRemover_${TAG}_jf12.0.zip" - name: Update manifest.json via API run: | API_URL="${{ github.api_url }}" REPO="${{ github.repository }}" TOKEN="${{ github.token }}" VERSION="${{ github.ref_name }}" VERSION="${VERSION#v}" CLEAN_VERSION="${VERSION%%-*}" cat > manifest.json <