Files
blackBarRemover/.gitea/workflows/release.yml
T
karol d849e4276a
Build and Release Plugin / release (push) Successful in 33s
Add Gitea Action for automated releases and repository manifest
2026-09-17 14:45:08 +02:00

94 lines
3.3 KiB
YAML

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: '10.0.x'
- name: Build Plugin
run: dotnet build JellyfinPlugin/JellyfinPlugin.csproj -c Release
- name: Create ZIP Archive
run: |
cd JellyfinPlugin/bin/Release/net10.0/
zip -j ../../../../BlackBarRemover_${{ github.ref_name }}.zip *
- name: Generate Checksum
id: checksum
run: |
MD5_SUM=$(md5sum BlackBarRemover_${{ github.ref_name }}.zip | awk '{print $1}')
echo "md5=$MD5_SUM" >> $GITHUB_OUTPUT
- name: Create Gitea Release
run: |
API_URL="${{ github.api_url }}"
REPO="${{ github.repository }}"
TOKEN="${{ github.token }}"
TAG="${{ github.ref_name }}"
# Create Release
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\":false}")
REL_ID=$(echo "$RELEASE_RES" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
# Upload Asset
curl -s -X POST "$API_URL/repos/$REPO/releases/$REL_ID/assets" \
-H "Authorization: token $TOKEN" \
-F "attachment=@BlackBarRemover_$TAG.zip"
- name: Update manifest.json
run: |
git config user.name "Gitea Actions"
git config user.email "actions@gitea.local"
git checkout -B manifest
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # remove 'v' prefix
cat > manifest.json <<EOF
[
{
"guid": "12345678-1234-1234-1234-1234567890ab",
"name": "Black Bar Remover",
"description": "Automatically detects and removes black bars from video files.",
"overview": "Automatically detects and removes black bars from video files via CSS or FFmpeg.",
"owner": "karol",
"category": "Playback",
"imageUrl": "",
"versions": [
{
"version": "$VERSION",
"changelog": "Automated Release ${{ github.ref_name }}",
"targetAbi": "12.0.0.0",
"sourceUrl": "${{ github.server_url }}/${{ github.repository }}",
"checksum": "${{ steps.checksum.outputs.md5 }}",
"timestamp": "$(date -u +'%Y-%m-%dT%H:%M:%SZ')",
"repositoryUrl": "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/BlackBarRemover_${{ github.ref_name }}.zip"
}
]
}
]
EOF
git add manifest.json
git commit -m "Update manifest for ${{ github.ref_name }}"
git push -f origin manifest