name: Publish Release # NOTE: This repo lives on a private Gitea instance # (https://www.git.quarantinedstudio.com/mvezina/CinemaTrailers4Jellyfins), not GitHub. # Gitea Actions understands a compatible subset of GitHub Actions syntax, but: # - GitHub-hosted actions (actions/checkout, actions/setup-dotnet) must be reachable # from your Gitea runner (directly, via a mirror, or vendored) to be usable as-is. # - softprops/action-gh-release talks to the GitHub API and will NOT work against # Gitea — it has been replaced below with direct calls to the Gitea Releases API # via curl, which needs a GITEA_TOKEN secret (an access token with repo write scope). # Treat this file as a starting template: verify runner/action availability and the # release-API calls against your instance before relying on it. on: push: tags: - 'v*.*.*.*' permissions: contents: write jobs: release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: token: ${{ secrets.GITEA_TOKEN }} fetch-depth: 0 - name: Setup .NET 9 uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' - name: Get version from tag id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - name: Build run: | dotnet publish \ Jellyfin.Plugin.CinemaTrailers4Jellyfins/Jellyfin.Plugin.CinemaTrailers4Jellyfins.csproj \ --configuration Release \ --output bin - name: Package run: | VERSION="${{ steps.version.outputs.VERSION }}" # Always include the plugin DLL itself, then all third-party dependencies. # Exclude Jellyfin/MediaBrowser framework DLLs — the server already has those loaded. DEPS=$(find bin -name "*.dll" \ | grep -Ev "/(Jellyfin\.|MediaBrowser\.|Microsoft\.|System\.|netstandard|mscorlib)" \ | tr '\n' ' ') zip -j "cinematrailers4jellyfins_${VERSION}.zip" \ bin/Jellyfin.Plugin.CinemaTrailers4Jellyfins.dll \ $DEPS - name: Checksum id: checksum run: | VERSION="${{ steps.version.outputs.VERSION }}" echo "MD5=$(md5sum cinematrailers4jellyfins_${VERSION}.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" - name: Update manifest.json run: | pip install pyyaml --quiet python3 update_manifest.py "${{ steps.version.outputs.VERSION }}" "${{ steps.checksum.outputs.MD5 }}" - name: Commit manifest run: | git config user.name "gitea-actions" git config user.email "gitea-actions@quarantinedstudio.com" git add manifest.json git commit -m "chore: update manifest.json for v${{ steps.version.outputs.VERSION }}" || echo "No changes to commit" git fetch origin main git rebase origin/main git push origin HEAD:main - name: Create Gitea release and upload asset env: GITEA_SERVER: https://www.git.quarantinedstudio.com GITEA_REPO: mvezina/CinemaTrailers4Jellyfins GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | VERSION="${{ steps.version.outputs.VERSION }}" TAG="${{ github.ref_name }}" ZIP="cinematrailers4jellyfins_${VERSION}.zip" BODY="See build.yaml for the changelog. To install, add ${GITEA_SERVER}/${GITEA_REPO}/raw/branch/main/manifest.json as a plugin repository in Jellyfin -> Admin -> Plugins -> Repositories." RELEASE_ID=$(curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\": \"${TAG}\", \"name\": \"Release ${TAG}\", \"body\": \"${BODY}\"}" \ "${GITEA_SERVER}/api/v1/repos/${GITEA_REPO}/releases" \ | python3 -c "import sys, json; print(json.load(sys.stdin)['id'])") curl -sf -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -F "attachment=@${ZIP}" \ "${GITEA_SERVER}/api/v1/repos/${GITEA_REPO}/releases/${RELEASE_ID}/assets?name=${ZIP}"